From b7410acce8b5fecd9469ee6a28a9029222609c0c Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 5 Sep 2010 21:39:07 +0300 Subject: [PATCH] * mu-cmd-index.c, mu-cmd-view.c, mu-msg-part.c: fix some overly long functions --- src/mu-cmd-index.c | 3 +-- src/mu-cmd-view.c | 32 +++++++++++--------------------- src/mu-msg-part.c | 9 ++++----- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/src/mu-cmd-index.c b/src/mu-cmd-index.c index 15b57824..2816da82 100644 --- a/src/mu-cmd-index.c +++ b/src/mu-cmd-index.c @@ -255,8 +255,7 @@ mu_cmd_index (MuConfigOptions *opts) mu_index_destroy (midx); MU_WRITE_LOG ("processed: %u; updated/new: %u, cleaned-up: %u", - (unsigned)stats._processed, - (unsigned)stats._updated, + (unsigned)stats._processed, (unsigned)stats._updated, (unsigned)stats._cleaned_up); if (!opts->quiet) diff --git a/src/mu-cmd-view.c b/src/mu-cmd-view.c index d5b71deb..e78c5d86 100644 --- a/src/mu-cmd-view.c +++ b/src/mu-cmd-view.c @@ -44,39 +44,29 @@ view_file (const gchar *path, const gchar *fields, size_t summary_len) if (!msg) return FALSE; - field = mu_msg_get_from (msg); - if (field) + if ((field = mu_msg_get_from (msg))) g_print ("From: %s\n", field); - field = mu_msg_get_to (msg); - if (field) + if ((field = mu_msg_get_to (msg))) g_print ("To: %s\n", field); - field = mu_msg_get_cc (msg); - if (field) + if ((field = mu_msg_get_cc (msg))) g_print ("Cc: %s\n", field); - field = mu_msg_get_subject (msg); - if (field) + if ((field = mu_msg_get_subject (msg))) g_print ("Subject: %s\n", field); - date = mu_msg_get_date (msg); - if (date) - g_print ("Date: %s\n", - mu_msg_str_date_s (date)); + if ((date = mu_msg_get_date (msg))) + g_print ("Date: %s\n", mu_msg_str_date_s (date)); if (summary_len > 0) { field = mu_msg_get_summary (msg, summary_len); g_print ("Summary: %s\n", field ? field : ""); - } else { - - field = mu_msg_get_body_text (msg); - if (field) - g_print ("\n%s\n", field); - else - /* not really an error */ - g_debug ("No text body found for %s", path); - } + } else if ((mu_msg_get_body_text (msg))) + g_print ("\n%s\n", field); + else + /* not really an error */ + g_debug ("No text body found for %s", path); mu_msg_destroy (msg); diff --git a/src/mu-msg-part.c b/src/mu-msg-part.c index 2b39c545..6121b8a4 100644 --- a/src/mu-msg-part.c +++ b/src/mu-msg-part.c @@ -117,12 +117,11 @@ save_part (GMimeObject *part, const char *filename, close (fd); return FALSE; } + + /* GMimeStream will close the fd */ + g_mime_stream_fs_set_owner (GMIME_STREAM_FS(stream), TRUE); - g_mime_stream_fs_set_owner (GMIME_STREAM_FS(stream), - TRUE); /* GMimeStream will close the fd */ - - wrapper = g_mime_part_get_content_object (GMIME_PART(part)); - if (!wrapper) { + if (!(wrapper = g_mime_part_get_content_object (GMIME_PART(part)))) { g_object_unref (G_OBJECT(stream)); g_critical ("%s: failed to create wrapper", __FUNCTION__); return FALSE;