From: Richard Russon Date: Thu, 20 Dec 2018 14:33:15 +0000 (+0000) Subject: mailbox: rename hdrmax to email_max X-Git-Tag: 2019-10-25~425 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c81bcb272c89fd60c2d6aa6e9ee8ca1370f7f0d7;p=neomutt mailbox: rename hdrmax to email_max --- diff --git a/imap/imap.c b/imap/imap.c index 6bf87743f..292f12bfe 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -2159,7 +2159,7 @@ static int imap_mbox_open(struct Mailbox *m, struct Context *ctx) m->readonly = true; } - m->hdrmax = count; + m->email_max = count; m->emails = mutt_mem_calloc(count, sizeof(struct Email *)); m->v2r = mutt_mem_calloc(count, sizeof(int)); m->msg_count = 0; diff --git a/imap/message.c b/imap/message.c index b324f3b0e..03b247ce8 100644 --- a/imap/message.c +++ b/imap/message.c @@ -868,7 +868,7 @@ static int read_headers_qresync_eval_cache(struct ImapAccountData *adata, char * mdata->max_msn = MAX(mdata->max_msn, msn); mdata->msn_index[msn - 1] = e; - if (m->msg_count >= m->hdrmax) + if (m->msg_count >= m->email_max) mx_alloc_memory(m); struct ImapEmailData *edata = imap_edata_new(); @@ -1191,7 +1191,7 @@ static int read_headers_fetch_new(struct Mailbox *m, unsigned int msn_begin, fetch_msn_end = mdata->max_msn; msn_begin = mdata->max_msn + 1; msn_end = mdata->new_mail_count; - while (msn_end > m->hdrmax) + while (msn_end > m->email_max) mx_alloc_memory(m); alloc_msn_index(adata, msn_end); mdata->reopen &= ~IMAP_NEWMAIL_PENDING; @@ -1248,7 +1248,7 @@ int imap_read_headers(struct Mailbox *m, unsigned int msn_begin, return -1; /* make sure context has room to hold the mailbox */ - while (msn_end > m->hdrmax) + while (msn_end > m->email_max) mx_alloc_memory(m); alloc_msn_index(adata, msn_end); imap_alloc_uid_hash(adata, msn_end); diff --git a/index.c b/index.c index 62ba7afc2..dde74c5ef 100644 --- a/index.c +++ b/index.c @@ -656,7 +656,7 @@ static int main_change_folder(struct Menu *menu, int op, struct Mailbox *m, */ void index_make_entry(char *buf, size_t buflen, struct Menu *menu, int line) { - if (!Context || !menu || (line < 0) || (line >= Context->mailbox->hdrmax)) + if (!Context || !menu || (line < 0) || (line >= Context->mailbox->email_max)) return; struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[line]]; diff --git a/mailbox.h b/mailbox.h index c323885ad..e8ab1420a 100644 --- a/mailbox.h +++ b/mailbox.h @@ -91,7 +91,7 @@ struct Mailbox int msg_tagged; /**< how many messages are tagged? */ struct Email **emails; - int hdrmax; /**< number of pointers in emails */ + int email_max; /**< number of pointers in emails */ int *v2r; /**< mapping from virtual to real msgno */ int vcount; /**< the number of virtual messages */ diff --git a/maildir/shared.c b/maildir/shared.c index 022160359..767196c0c 100644 --- a/maildir/shared.c +++ b/maildir/shared.c @@ -430,7 +430,7 @@ static int maildir_add_to_context(struct Mailbox *m, struct Maildir *md) if (!m->emails) { /* Allocate some memory to get started */ - m->hdrmax = m->msg_count; + m->email_max = m->msg_count; m->msg_count = 0; m->vcount = 0; mx_alloc_memory(m); @@ -446,7 +446,7 @@ static int maildir_add_to_context(struct Mailbox *m, struct Maildir *md) md->email->flagged ? "f" : "", md->email->deleted ? "D" : "", md->email->replied ? "r" : "", md->email->old ? "O" : "", md->email->read ? "R" : ""); - if (m->msg_count == m->hdrmax) + if (m->msg_count == m->email_max) mx_alloc_memory(m); m->emails[m->msg_count] = md->email; diff --git a/mbox/mbox.c b/mbox/mbox.c index 099b03306..dcdcf8578 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -234,7 +234,7 @@ static int mmdf_parse_mailbox(struct Mailbox *m) if (!m->quiet) mutt_progress_update(&progress, count, (int) (loc / (m->size / 100 + 1))); - if (m->msg_count == m->hdrmax) + if (m->msg_count == m->email_max) mx_alloc_memory(m); e = mutt_email_new(); m->emails[m->msg_count] = e; @@ -385,7 +385,7 @@ static int mbox_parse_mailbox(struct Mailbox *m) if (!m->emails) { /* Allocate some memory to get started */ - m->hdrmax = m->msg_count; + m->email_max = m->msg_count; m->msg_count = 0; m->msg_unread = 0; m->vcount = 0; @@ -419,7 +419,7 @@ static int mbox_parse_mailbox(struct Mailbox *m) (int) (ftello(adata->fp) / (m->size / 100 + 1))); } - if (m->msg_count == m->hdrmax) + if (m->msg_count == m->email_max) mx_alloc_memory(m); m->emails[m->msg_count] = mutt_email_new(); @@ -613,7 +613,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) m->emails = NULL; } - m->hdrmax = 0; /* force allocation of new headers */ + m->email_max = 0; /* force allocation of new headers */ m->msg_count = 0; m->vcount = 0; ctx->vsize = 0; diff --git a/mx.c b/mx.c index 42b63fb5c..6364d8beb 100644 --- a/mx.c +++ b/mx.c @@ -1206,24 +1206,24 @@ void mx_alloc_memory(struct Mailbox *m) { size_t s = MAX(sizeof(struct Email *), sizeof(int)); - if ((m->hdrmax + 25) * s < m->hdrmax * s) + if ((m->email_max + 25) * s < m->email_max * s) { mutt_error(_("Out of memory")); mutt_exit(1); } - m->hdrmax += 25; + m->email_max += 25; if (m->emails) { - mutt_mem_realloc(&m->emails, sizeof(struct Email *) * m->hdrmax); - mutt_mem_realloc(&m->v2r, sizeof(int) * m->hdrmax); + mutt_mem_realloc(&m->emails, sizeof(struct Email *) * m->email_max); + mutt_mem_realloc(&m->v2r, sizeof(int) * m->email_max); } else { - m->emails = mutt_mem_calloc(m->hdrmax, sizeof(struct Email *)); - m->v2r = mutt_mem_calloc(m->hdrmax, sizeof(int)); + m->emails = mutt_mem_calloc(m->email_max, sizeof(struct Email *)); + m->v2r = mutt_mem_calloc(m->email_max, sizeof(int)); } - for (int i = m->msg_count; i < m->hdrmax; i++) + for (int i = m->msg_count; i < m->email_max; i++) { m->emails[i] = NULL; m->v2r[i] = -1; diff --git a/nntp/nntp.c b/nntp/nntp.c index 85446333f..daaaca4d6 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -1138,7 +1138,7 @@ static int parse_overview_line(char *line, void *data) rewind(fp); /* allocate memory for headers */ - if (m->msg_count >= m->hdrmax) + if (m->msg_count >= m->email_max) mx_alloc_memory(m); /* parse header */ @@ -1263,7 +1263,7 @@ static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t if (!m->emails) { /* Allocate some memory to get started */ - m->hdrmax = m->msg_count; + m->email_max = m->msg_count; m->msg_count = 0; m->vcount = 0; mx_alloc_memory(m); @@ -1333,7 +1333,7 @@ static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t continue; /* allocate memory for headers */ - if (m->msg_count >= m->hdrmax) + if (m->msg_count >= m->email_max) mx_alloc_memory(m); #ifdef USE_HCACHE @@ -1653,7 +1653,7 @@ static int check_mailbox(struct Context *ctx) if (hdata) { mutt_debug(2, "#2 mutt_hcache_fetch %s\n", buf); - if (m->msg_count >= m->hdrmax) + if (m->msg_count >= m->email_max) mx_alloc_memory(m); e = mutt_hcache_restore(hdata); @@ -2253,7 +2253,7 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid) } /* parse header */ - if (m->msg_count == m->hdrmax) + if (m->msg_count == m->email_max) mx_alloc_memory(m); m->emails[m->msg_count] = mutt_email_new(); struct Email *e = m->emails[m->msg_count]; diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index dccdb8cba..29d836d40 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -905,7 +905,7 @@ static void append_message(struct Mailbox *m, notmuch_query_t *q, mutt_debug(2, "nm: appending message, i=%d, id=%s, path=%s\n", m->msg_count, notmuch_message_get_message_id(msg), path); - if (m->msg_count >= m->hdrmax) + if (m->msg_count >= m->email_max) { mutt_debug(2, "nm: allocate mx memory\n"); mx_alloc_memory(m); @@ -2126,7 +2126,7 @@ static int nm_mbox_open(struct Mailbox *m, struct Context *ctx) if (!m->emails) { /* Allocate some memory to get started */ - m->hdrmax = m->msg_count; + m->email_max = m->msg_count; m->msg_count = 0; m->vcount = 0; m->size = 0; diff --git a/pop/pop.c b/pop/pop.c index cd16e78c4..594c81d3a 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -288,7 +288,7 @@ static int fetch_uidl(char *line, void *data) { mutt_debug(1, "new header %d %s\n", index, line); - if (i >= m->hdrmax) + if (i >= m->email_max) mx_alloc_memory(m); m->msg_count++; @@ -397,7 +397,7 @@ static int pop_fetch_headers(struct Context *ctx) if (!m->emails) { /* Allocate some memory to get started */ - m->hdrmax = m->msg_count; + m->email_max = m->msg_count; m->msg_count = 0; m->msg_unread = 0; m->vcount = 0;