From: Vincent Lefevre Date: Sat, 21 Jul 2018 23:35:32 +0000 (+0200) Subject: Cleanup: avoid an ugly local preprocessor macro. X-Git-Tag: mutt-1-11-rel~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9eddeabee95e6a93f3731dcdb29e1970dd8895f;p=mutt Cleanup: avoid an ugly local preprocessor macro. Note: This macro was also hiding the use of a variable, making the code difficult to read. --- diff --git a/curs_main.c b/curs_main.c index 12a2eaf2..1647a386 100644 --- a/curs_main.c +++ b/curs_main.c @@ -434,7 +434,6 @@ static void update_index_unthreaded (CONTEXT *ctx, int check, int oldcount) * they will be visible in the limited view */ if (ctx->pattern) { -#define THIS_BODY ctx->hdrs[j]->content for (j = (check == MUTT_REOPENED) ? 0 : oldcount; j < ctx->msgcount; j++) { if (!j) @@ -444,15 +443,16 @@ static void update_index_unthreaded (CONTEXT *ctx, int check, int oldcount) MUTT_MATCH_FULL_ADDRESS, ctx, ctx->hdrs[j], NULL)) { + BODY *this_body = ctx->hdrs[j]->content; + assert (ctx->vcount < ctx->msgcount); ctx->hdrs[j]->virtual = ctx->vcount; ctx->v2r[ctx->vcount] = j; ctx->hdrs[j]->limited = 1; ctx->vcount++; - ctx->vsize += THIS_BODY->length + THIS_BODY->offset - THIS_BODY->hdr_offset; + ctx->vsize += this_body->length + this_body->offset - this_body->hdr_offset; } } -#undef THIS_BODY } /* if the mailbox was reopened, need to rethread from scratch */ diff --git a/pattern.c b/pattern.c index 7ce968ab..cfe4a700 100644 --- a/pattern.c +++ b/pattern.c @@ -1475,8 +1475,6 @@ int mutt_pattern_func (int op, char *prompt) MUTT_PROGRESS_MSG, ReadInc, (op == MUTT_LIMIT) ? Context->msgcount : Context->vcount); -#define THIS_BODY Context->hdrs[i]->content - if (op == MUTT_LIMIT) { Context->vcount = 0; @@ -1493,12 +1491,14 @@ int mutt_pattern_func (int op, char *prompt) Context->hdrs[i]->num_hidden = 0; if (mutt_pattern_exec (pat, MUTT_MATCH_FULL_ADDRESS, Context, Context->hdrs[i], NULL)) { + BODY *this_body = Context->hdrs[i]->content; + Context->hdrs[i]->virtual = Context->vcount; Context->hdrs[i]->limited = 1; Context->v2r[Context->vcount] = i; Context->vcount++; - Context->vsize+=THIS_BODY->length + THIS_BODY->offset - - THIS_BODY->hdr_offset; + Context->vsize += this_body->length + this_body->offset - + this_body->hdr_offset; } } } @@ -1528,8 +1528,6 @@ int mutt_pattern_func (int op, char *prompt) } } -#undef THIS_BODY - mutt_clear_error (); if (op == MUTT_LIMIT)