From: Kevin McCarthy Date: Tue, 21 Aug 2018 22:51:09 +0000 (-0700) Subject: Fix nested macro warning. X-Git-Tag: mutt-1-11-rel~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d3b82b771c3698c758db3c47b69c539cca062c6;p=mutt Fix nested macro warning. Pull the #if/#else outside of the snprintf in imap.c. On some platforms, snprintf is a macro itself, which leads to a warning about undefined behavior. Thanks to Charles Diza for pointing out the problem. --- diff --git a/imap/imap.c b/imap/imap.c index f1997ac8..05e24f26 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -604,6 +604,7 @@ static int imap_open_mailbox (CONTEXT* ctx) int count = 0; IMAP_MBOX mx, pmx; int rc; + const char *condstore; if (imap_parse_path (ctx->path, &mx)) { @@ -669,15 +670,17 @@ static int imap_open_mailbox (CONTEXT* ctx) imap_status (Postponed, 1); FREE (&pmx.mbox); - snprintf (bufout, sizeof (bufout), "%s %s%s", - ctx->readonly ? "EXAMINE" : "SELECT", - buf, #if USE_HCACHE - mutt_bit_isset (idata->capabilities, CONDSTORE) && - option (OPTIMAPCONDSTORE) ? " (CONDSTORE)" : ""); -#else - ""); + if (mutt_bit_isset (idata->capabilities, CONDSTORE) && + option (OPTIMAPCONDSTORE)) + condstore = " (CONDSTORE)"; + else #endif + condstore = ""; + + snprintf (bufout, sizeof (bufout), "%s %s%s", + ctx->readonly ? "EXAMINE" : "SELECT", + buf, condstore); idata->state = IMAP_SELECTED;