* 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,10 +141,13 @@ mu_output_links (MuMsgIter *iter, const char* linksdir,
static void
ansi_color (MuMsgFieldId mfid)
ansi_color_maybe (MuMsgFieldId mfid, gboolean color)
{
const char* ansi;
if (!color)
return; /* nothing to do */
switch (mfid) {
case MU_MSG_FIELD_ID_FROM:
@ -173,13 +176,18 @@ ansi_color (MuMsgFieldId mfid)
static void
ansi_reset (MuMsgFieldId mfid)
ansi_reset_maybe (MuMsgFieldId mfid, gboolean color)
{
if (!color)
return; /* nothing to do */
fputs (MU_COLOR_DEFAULT, stdout);
}
static const char*
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)))
len += printf ("%c", *myfields);
else {
if (color) ansi_color (mfid);
ansi_color_maybe (mfid, color);
len += fputs (display_field (myiter, mfid), stdout);
if (color) ansi_reset (mfid);
ansi_reset_maybe (mfid, color);
}
}