[gmime] slight optimization
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] slight optimization
- Date: Sun, 3 Dec 2017 21:37:29 +0000 (UTC)
commit aadf0af693ccac7b44bdab6ea2645ae0191e29cd
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Fri Nov 24 22:59:05 2017 -0500
slight optimization
gmime/gmime-multipart.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/gmime/gmime-multipart.c b/gmime/gmime-multipart.c
index c8530c2..2c896d7 100644
--- a/gmime/gmime-multipart.c
+++ b/gmime/gmime-multipart.c
@@ -189,16 +189,20 @@ multipart_write_to_stream (GMimeObject *object, GMimeFormatOptions *options, gbo
}
/* don't hide the headers of any children of a multipart/signed */
- is_signed = g_mime_content_type_is_type (object->content_type, "multipart", "signed");
- format = _g_mime_format_options_clone (options, !is_signed);
- /*if (is_signed) g_mime_format_options_set_allow_international (format, FALSE); */
+ if ((is_signed = g_mime_content_type_is_type (object->content_type, "multipart", "signed"))) {
+ format = _g_mime_format_options_clone (options, FALSE);
+ /* g_mime_format_options_set_allow_international (format, FALSE); */
+ } else {
+ format = options;
+ }
for (i = 0; i < multipart->children->len; i++) {
part = multipart->children->pdata[i];
/* write the boundary */
if ((nwritten = g_mime_stream_printf (stream, "--%s%s", boundary, newline)) == -1) {
- g_mime_format_options_free (format);
+ if (is_signed)
+ g_mime_format_options_free (format);
return -1;
}
@@ -206,7 +210,8 @@ multipart_write_to_stream (GMimeObject *object, GMimeFormatOptions *options, gbo
/* write this part out */
if ((nwritten = g_mime_object_write_to_stream (part, format, stream)) == -1) {
- g_mime_format_options_free (format);
+ if (is_signed)
+ g_mime_format_options_free (format);
return -1;
}
@@ -214,7 +219,8 @@ multipart_write_to_stream (GMimeObject *object, GMimeFormatOptions *options, gbo
if (!GMIME_IS_MULTIPART (part) || ((GMimeMultipart *) part)->write_end_boundary) {
if ((nwritten = g_mime_stream_write_string (stream, newline)) == -1) {
- g_mime_format_options_free (format);
+ if (is_signed)
+ g_mime_format_options_free (format);
return -1;
}
@@ -222,7 +228,8 @@ multipart_write_to_stream (GMimeObject *object, GMimeFormatOptions *options, gbo
}
}
- g_mime_format_options_free (format);
+ if (is_signed)
+ g_mime_format_options_free (format);
/* write the end-boundary (but only if a boundary is set) */
if (multipart->write_end_boundary && boundary) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]