From 5bd13a8b926ec5113c92d16833927dc7157d388c Mon Sep 17 00:00:00 2001 From: Federico Kircheis Date: Sat, 29 Jun 2019 20:57:10 +0200 Subject: [PATCH] Replace `virtual` variable with `vnum` `virtual` is a reserved keyword in c++ --- context.c | 8 ++++---- email/email.h | 2 +- email/thread.c | 4 ++-- index.c | 52 +++++++++++++++++++++++++------------------------- mutt_thread.c | 44 +++++++++++++++++++++--------------------- mutt_thread.h | 2 +- pager.c | 2 +- pattern.c | 8 ++++---- sort.c | 6 +++--- 9 files changed, 64 insertions(+), 64 deletions(-) diff --git a/context.c b/context.c index aacef0942..baf24024f 100644 --- a/context.c +++ b/context.c @@ -104,10 +104,10 @@ void ctx_update(struct Context *ctx) if (!ctx->pattern) { m->v2r[m->vcount] = msgno; - e->virtual = m->vcount++; + e->vnum = m->vcount++; } else - e->virtual = -1; + e->vnum = -1; e->msgno = msgno; if (e->env->supersedes) @@ -189,10 +189,10 @@ void ctx_update_tables(struct Context *ctx, bool committing) m->emails[i] = NULL; } m->emails[j]->msgno = j; - if (m->emails[j]->virtual != -1) + if (m->emails[j]->vnum != -1) { m->v2r[m->vcount] = j; - m->emails[j]->virtual = m->vcount++; + m->emails[j]->vnum = m->vcount++; struct Body *b = m->emails[j]->content; ctx->vsize += b->length + b->offset - b->hdr_offset + padding; } diff --git a/email/email.h b/email/email.h index 6f31989c6..cce4cb50d 100644 --- a/email/email.h +++ b/email/email.h @@ -87,7 +87,7 @@ struct Email int lines; /**< how many lines in the body of this message? */ int index; /**< the absolute (unsorted) message number */ int msgno; /**< number displayed to the user */ - int virtual; /**< virtual message number */ + int vnum; /**< virtual message number */ int score; struct Envelope *env; /**< envelope information */ struct Body *content; /**< list of MIME parts */ diff --git a/email/thread.c b/email/thread.c index 622155f7a..5076cdde9 100644 --- a/email/thread.c +++ b/email/thread.c @@ -127,7 +127,7 @@ struct Email *find_virtual(struct MuttThread *cur, int reverse) struct MuttThread *top = NULL; - if (cur->message && (cur->message->virtual >= 0)) + if (cur->message && (cur->message->vnum >= 0)) return cur->message; top = cur; @@ -140,7 +140,7 @@ struct Email *find_virtual(struct MuttThread *cur, int reverse) while (true) { - if (cur->message && (cur->message->virtual >= 0)) + if (cur->message && (cur->message->vnum >= 0)) return cur->message; if (cur->child) diff --git a/index.c b/index.c index 2ca8a2041..4ca0820eb 100644 --- a/index.c +++ b/index.c @@ -252,7 +252,7 @@ static void collapse_all(struct Menu *menu, int toggle) else if (CAN_COLLAPSE(CUR_EMAIL)) final = mutt_collapse_thread(Context, CUR_EMAIL); else - final = CUR_EMAIL->virtual; + final = CUR_EMAIL->vnum; if (final == -1) return; @@ -279,7 +279,7 @@ static void collapse_all(struct Menu *menu, int toggle) } /* Restore the cursor */ - mutt_set_virtual(Context); + mutt_set_vnum(Context); for (int j = 0; j < Context->mailbox->vcount; j++) { if (Context->mailbox->emails[Context->mailbox->v2r[j]]->index == base->index) @@ -464,9 +464,9 @@ static void update_index_threaded(struct Context *ctx, int check, int oldcount) if (mutt_pattern_exec(SLIST_FIRST(ctx->limit_pattern), MUTT_MATCH_FULL_ADDRESS, ctx->mailbox, e, NULL)) { - /* virtual will get properly set by mutt_set_virtual(), which + /* vnum will get properly set by mutt_set_vnum(), which * is called by mutt_sort_headers() just below. */ - e->virtual = 1; + e->vnum = 1; e->limited = true; } } @@ -488,7 +488,7 @@ static void update_index_threaded(struct Context *ctx, int check, int oldcount) ; mutt_uncollapse_thread(ctx, j->message); } - mutt_set_virtual(ctx); + mutt_set_vnum(ctx); } else if (oldcount) { @@ -499,7 +499,7 @@ static void update_index_threaded(struct Context *ctx, int check, int oldcount) mutt_uncollapse_thread(ctx, save_new[j]); } } - mutt_set_virtual(ctx); + mutt_set_vnum(ctx); } } @@ -532,7 +532,7 @@ static void update_index_unthreaded(struct Context *ctx, int check, int oldcount ctx->mailbox, ctx->mailbox->emails[i], NULL)) { assert(ctx->mailbox->vcount < ctx->mailbox->msg_count); - ctx->mailbox->emails[i]->virtual = ctx->mailbox->vcount; + ctx->mailbox->emails[i]->vnum = ctx->mailbox->vcount; ctx->mailbox->v2r[ctx->mailbox->vcount] = i; ctx->mailbox->emails[i]->limited = true; ctx->mailbox->vcount++; @@ -776,7 +776,7 @@ void index_make_entry(char *buf, size_t buflen, struct Menu *menu, int line) flags |= MUTT_FORMAT_FORCESUBJ; break; } - else if (tmp->message->virtual >= 0) + else if (tmp->message->vnum >= 0) break; } if (flags & MUTT_FORMAT_FORCESUBJ) @@ -789,7 +789,7 @@ void index_make_entry(char *buf, size_t buflen, struct Menu *menu, int line) /* ...but if a previous sibling is available, don't force it */ if (reverse ? (tmp->message->msgno > edgemsgno) : (tmp->message->msgno < edgemsgno)) break; - else if (tmp->message->virtual >= 0) + else if (tmp->message->vnum >= 0) { flags &= ~MUTT_FORMAT_FORCESUBJ; break; @@ -1385,16 +1385,16 @@ int mutt_index_menu(void) e = mutt_hash_find(Context->mailbox->id_hash, buf); if (e) { - if (e->virtual != -1) + if (e->vnum != -1) { - menu->current = e->virtual; + menu->current = e->vnum; menu->redraw = REDRAW_MOTION_RESYNC; } else if (e->collapsed) { mutt_uncollapse_thread(Context, e); - mutt_set_virtual(Context); - menu->current = e->virtual; + mutt_set_vnum(Context); + menu->current = e->vnum; menu->redraw = REDRAW_MOTION_RESYNC; } else @@ -1408,7 +1408,7 @@ int mutt_index_menu(void) { e = Context->mailbox->emails[Context->mailbox->msg_count - 1]; mutt_sort_headers(Context, false); - menu->current = e->virtual; + menu->current = e->vnum; menu->redraw = REDRAW_FULL; } else if (rc > 0) @@ -1480,7 +1480,7 @@ int mutt_index_menu(void) * update the index */ if (menu->menu == MENU_PAGER) { - menu->current = oldcur->virtual; + menu->current = oldcur->vnum; menu->redraw = REDRAW_STATUS | REDRAW_INDEX; op = OP_DISPLAY_MESSAGE; continue; @@ -1489,7 +1489,7 @@ int mutt_index_menu(void) /* if the root message was retrieved, move to it */ e = mutt_hash_find(Context->mailbox->id_hash, buf); if (e) - menu->current = e->virtual; + menu->current = e->vnum; /* try to restore old position */ else @@ -1498,7 +1498,7 @@ int mutt_index_menu(void) { if (Context->mailbox->emails[i]->index == oldindex) { - menu->current = Context->mailbox->emails[i]->virtual; + menu->current = Context->mailbox->emails[i]->vnum; /* as an added courtesy, recenter the menu * with the current entry at the middle of the screen */ menu_check_recenter(menu); @@ -1549,9 +1549,9 @@ int mutt_index_menu(void) if (mutt_messages_in_thread(Context->mailbox, e, 1) > 1) { mutt_uncollapse_thread(Context, e); - mutt_set_virtual(Context); + mutt_set_vnum(Context); } - menu->current = e->virtual; + menu->current = e->vnum; } if (menu->menu == MENU_PAGER) @@ -1992,13 +1992,13 @@ int mutt_index_menu(void) if (oldcount < Context->mailbox->msg_count) { /* nm_read_entire_thread() triggers mutt_sort_headers() if necessary */ - menu->current = oldcur->virtual; + menu->current = oldcur->vnum; menu->redraw = REDRAW_STATUS | REDRAW_INDEX; if (oldcur->collapsed || Context->collapsed) { menu->current = mutt_uncollapse_thread(Context, CUR_EMAIL); - mutt_set_virtual(Context); + mutt_set_vnum(Context); } } if (menu->menu == MENU_PAGER) @@ -2332,7 +2332,7 @@ int mutt_index_menu(void) if (((C_Sort & SORT_MASK) == SORT_THREADS) && CUR_EMAIL->collapsed) { mutt_uncollapse_thread(Context, CUR_EMAIL); - mutt_set_virtual(Context); + mutt_set_vnum(Context); if (C_UncollapseJump) menu->current = mutt_thread_next_unread(Context, CUR_EMAIL); } @@ -2404,7 +2404,7 @@ int mutt_index_menu(void) mutt_break_thread(CUR_EMAIL); mutt_sort_headers(Context, true); - menu->current = oldcur->virtual; + menu->current = oldcur->vnum; } Context->mailbox->changed = true; @@ -2448,7 +2448,7 @@ int mutt_index_menu(void) if (mutt_link_threads(CUR_EMAIL, &el, Context->mailbox)) { mutt_sort_headers(Context, true); - menu->current = oldcur->virtual; + menu->current = oldcur->vnum; Context->mailbox->changed = true; mutt_message(_("Threads linked")); @@ -2936,14 +2936,14 @@ int mutt_index_menu(void) if (CUR_EMAIL->collapsed) { menu->current = mutt_uncollapse_thread(Context, CUR_EMAIL); - mutt_set_virtual(Context); + mutt_set_vnum(Context); if (C_UncollapseJump) menu->current = mutt_thread_next_unread(Context, CUR_EMAIL); } else if (CAN_COLLAPSE(CUR_EMAIL)) { menu->current = mutt_collapse_thread(Context, CUR_EMAIL); - mutt_set_virtual(Context); + mutt_set_vnum(Context); } else { diff --git a/mutt_thread.c b/mutt_thread.c index 8cd541113..a14d3076e 100644 --- a/mutt_thread.c +++ b/mutt_thread.c @@ -65,7 +65,7 @@ bool C_ThreadReceived; ///< Config: Sort threaded messages by their received dat */ static bool is_visible(struct Email *e, struct Context *ctx) { - return e->virtual >= 0 || (e->collapsed && (!ctx->pattern || e->limited)); + return e->vnum >= 0 || (e->collapsed && (!ctx->pattern || e->limited)); } /** @@ -1082,7 +1082,7 @@ int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads) if ((C_Sort & SORT_MASK) != SORT_THREADS) { mutt_error(_("Threading is not enabled")); - return e->virtual; + return e->vnum; } cur = e->thread; @@ -1127,7 +1127,7 @@ int mutt_aside_thread(struct Email *e, bool forwards, bool subthreads) } while (!tmp); } - return tmp->virtual; + return tmp->vnum; } /** @@ -1146,7 +1146,7 @@ int mutt_parent_message(struct Context *ctx, struct Email *e, bool find_root) if ((C_Sort & SORT_MASK) != SORT_THREADS) { mutt_error(_("Threading is not enabled")); - return e->virtual; + return e->vnum; } /* Root may be the current message */ @@ -1177,14 +1177,14 @@ int mutt_parent_message(struct Context *ctx, struct Email *e, bool find_root) mutt_error(_("Parent message is not visible in this limited view")); return -1; } - return parent->virtual; + return parent->vnum; } /** - * mutt_set_virtual - Set the virtual index number of all the messages in a mailbox + * mutt_set_vnum - Set the virtual index number of all the messages in a mailbox * @param ctx Mailbox */ -void mutt_set_virtual(struct Context *ctx) +void mutt_set_vnum(struct Context *ctx) { if (!ctx || !ctx->mailbox) return; @@ -1200,9 +1200,9 @@ void mutt_set_virtual(struct Context *ctx) for (int i = 0; i < m->msg_count; i++) { cur = m->emails[i]; - if (cur->virtual >= 0) + if (cur->vnum >= 0) { - cur->virtual = m->vcount; + cur->vnum = m->vcount; m->v2r[m->vcount] = i; m->vcount++; ctx->vsize += cur->content->length + cur->content->offset - @@ -1226,16 +1226,16 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags int final, reverse = (C_Sort & SORT_REVERSE), minmsgno; int num_hidden = 0, new = 0, old = 0; bool flagged = false; - int min_unread_msgno = INT_MAX, min_unread = cur->virtual; + int min_unread_msgno = INT_MAX, min_unread = cur->vnum; #define CHECK_LIMIT (!ctx->pattern || cur->limited) if (((C_Sort & SORT_MASK) != SORT_THREADS) && !(flag & MUTT_THREAD_GET_HIDDEN)) { mutt_error(_("Threading is not enabled")); - return cur->virtual; + return cur->vnum; } - final = cur->virtual; + final = cur->vnum; thread = cur->thread; while (thread->parent) thread = thread->parent; @@ -1253,7 +1253,7 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags new = 1; if (cur->msgno < min_unread_msgno) { - min_unread = cur->virtual; + min_unread = cur->vnum; min_unread_msgno = cur->msgno; } } @@ -1261,18 +1261,18 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags if (cur->flagged && CHECK_LIMIT) flagged = true; - if ((cur->virtual == -1) && CHECK_LIMIT) + if ((cur->vnum == -1) && CHECK_LIMIT) num_hidden++; if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE)) { cur->pair = 0; /* force index entry's color to be re-evaluated */ cur->collapsed = flag & MUTT_THREAD_COLLAPSE; - if (cur->virtual != -1) + if (cur->vnum != -1) { roothdr = cur; if (flag & MUTT_THREAD_COLLAPSE) - final = roothdr->virtual; + final = roothdr->vnum; } } @@ -1305,24 +1305,24 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags { roothdr = cur; if (flag & MUTT_THREAD_COLLAPSE) - final = roothdr->virtual; + final = roothdr->vnum; } if (reverse && (flag & MUTT_THREAD_COLLAPSE) && (cur->msgno < minmsgno) && CHECK_LIMIT) { minmsgno = cur->msgno; - final = cur->virtual; + final = cur->vnum; } if (flag & MUTT_THREAD_COLLAPSE) { if (cur != roothdr) - cur->virtual = -1; + cur->vnum = -1; } else { if (CHECK_LIMIT) - cur->virtual = cur->msgno; + cur->vnum = cur->msgno; } } @@ -1334,7 +1334,7 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags new = 1; if (cur->msgno < min_unread_msgno) { - min_unread = cur->virtual; + min_unread = cur->vnum; min_unread_msgno = cur->msgno; } } @@ -1342,7 +1342,7 @@ int mutt_traverse_thread(struct Context *ctx, struct Email *cur, MuttThreadFlags if (cur->flagged && CHECK_LIMIT) flagged = true; - if ((cur->virtual == -1) && CHECK_LIMIT) + if ((cur->vnum == -1) && CHECK_LIMIT) num_hidden++; } diff --git a/mutt_thread.h b/mutt_thread.h index a928aa0f8..aebc67567 100644 --- a/mutt_thread.h +++ b/mutt_thread.h @@ -72,7 +72,7 @@ bool mutt_link_threads (struct Email *parent, struct EmailLis struct Hash * mutt_make_id_hash (struct Mailbox *m); int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, int flag); int mutt_parent_message (struct Context *ctx, struct Email *e, bool find_root); -void mutt_set_virtual (struct Context *ctx); +void mutt_set_vnum (struct Context *ctx); struct MuttThread *mutt_sort_subthreads (struct MuttThread *thread, bool init); void mutt_sort_threads (struct Context *ctx, bool init); diff --git a/pager.c b/pager.c index 8a681c2ff..47fb513b5 100644 --- a/pager.c +++ b/pager.c @@ -2029,7 +2029,7 @@ static void pager_custom_redraw(struct Menu *pager_menu) rd->index->menu_make_entry = index_make_entry; rd->index->menu_color = index_color; rd->index->max = Context ? Context->mailbox->vcount : 0; - rd->index->current = rd->extra->email->virtual; + rd->index->current = rd->extra->email->vnum; rd->index->indexwin = rd->index_window; rd->index->statuswin = rd->index_status_window; } diff --git a/pattern.c b/pattern.c index bfdc4308a..498bde30a 100644 --- a/pattern.c +++ b/pattern.c @@ -2388,7 +2388,7 @@ bool mutt_limit_current_thread(struct Email *e) for (int i = 0; i < Context->mailbox->msg_count; i++) { - Context->mailbox->emails[i]->virtual = -1; + Context->mailbox->emails[i]->vnum = -1; Context->mailbox->emails[i]->limited = false; Context->mailbox->emails[i]->collapsed = false; Context->mailbox->emails[i]->num_hidden = 0; @@ -2397,7 +2397,7 @@ bool mutt_limit_current_thread(struct Email *e) { struct Body *body = Context->mailbox->emails[i]->content; - Context->mailbox->emails[i]->virtual = Context->mailbox->vcount; + Context->mailbox->emails[i]->vnum = Context->mailbox->vcount; Context->mailbox->emails[i]->limited = true; Context->mailbox->v2r[Context->mailbox->vcount] = i; Context->mailbox->vcount++; @@ -2469,14 +2469,14 @@ int mutt_pattern_func(int op, char *prompt) { mutt_progress_update(&progress, i, -1); /* new limit pattern implicitly uncollapses all threads */ - Context->mailbox->emails[i]->virtual = -1; + Context->mailbox->emails[i]->vnum = -1; Context->mailbox->emails[i]->limited = false; Context->mailbox->emails[i]->collapsed = false; Context->mailbox->emails[i]->num_hidden = 0; if (mutt_pattern_exec(SLIST_FIRST(pat), MUTT_MATCH_FULL_ADDRESS, Context->mailbox, Context->mailbox->emails[i], NULL)) { - Context->mailbox->emails[i]->virtual = Context->mailbox->vcount; + Context->mailbox->emails[i]->vnum = Context->mailbox->vcount; Context->mailbox->emails[i]->limited = true; Context->mailbox->v2r[Context->mailbox->vcount] = i; Context->mailbox->vcount++; diff --git a/sort.c b/sort.c index fe9743e27..729c6448f 100644 --- a/sort.c +++ b/sort.c @@ -431,9 +431,9 @@ void mutt_sort_headers(struct Context *ctx, bool init) for (int i = 0; i < ctx->mailbox->msg_count; i++) { struct Email *cur = ctx->mailbox->emails[i]; - if ((cur->virtual != -1) || (cur->collapsed && (!ctx->pattern || cur->limited))) + if ((cur->vnum != -1) || (cur->collapsed && (!ctx->pattern || cur->limited))) { - cur->virtual = ctx->mailbox->vcount; + cur->vnum = ctx->mailbox->vcount; ctx->mailbox->v2r[ctx->mailbox->vcount] = i; ctx->mailbox->vcount++; } @@ -454,7 +454,7 @@ void mutt_sort_headers(struct Context *ctx, bool init) mutt_collapse_thread(ctx, e); top = top->next; } - mutt_set_virtual(ctx); + mutt_set_vnum(ctx); } if (!ctx->mailbox->quiet) -- 2.40.0