* mu-output: push cyclomatic complexity <= 10 to satisfy 'make cc10'

This commit is contained in:
Dirk-Jan C. Binnema
2011-05-29 13:58:17 +03:00
parent 0dcc122c0f
commit a34738c882

View File

@ -141,9 +141,12 @@ mu_output_links (MuMsgIter *iter, const char* linksdir,
static void static void
ansi_color (MuMsgFieldId mfid) ansi_color_maybe (MuMsgFieldId mfid, gboolean color)
{ {
const char* ansi; const char* ansi;
if (!color)
return; /* nothing to do */
switch (mfid) { switch (mfid) {
@ -173,13 +176,18 @@ ansi_color (MuMsgFieldId mfid)
static void static void
ansi_reset (MuMsgFieldId mfid) ansi_reset_maybe (MuMsgFieldId mfid, gboolean color)
{ {
if (!color)
return; /* nothing to do */
fputs (MU_COLOR_DEFAULT, stdout); fputs (MU_COLOR_DEFAULT, stdout);
} }
static const char* static const char*
display_field (MuMsgIter *iter, MuMsgFieldId mfid) display_field (MuMsgIter *iter, MuMsgFieldId mfid)
{ {
@ -267,9 +275,9 @@ mu_output_plain (MuMsgIter *iter, const char *fields, gboolean summary,
!mu_msg_field_xapian_contact (mfid))) !mu_msg_field_xapian_contact (mfid)))
len += printf ("%c", *myfields); len += printf ("%c", *myfields);
else { else {
if (color) ansi_color (mfid); ansi_color_maybe (mfid, color);
len += fputs (display_field (myiter, mfid), stdout); len += fputs (display_field (myiter, mfid), stdout);
if (color) ansi_reset (mfid); ansi_reset_maybe (mfid, color);
} }
} }