]> granicus.if.org Git - neomutt/commitdiff
mailbox: rename hdrmax to email_max
authorRichard Russon <rich@flatcap.org>
Thu, 20 Dec 2018 14:33:15 +0000 (14:33 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 20 Dec 2018 14:50:11 +0000 (14:50 +0000)
imap/imap.c
imap/message.c
index.c
mailbox.h
maildir/shared.c
mbox/mbox.c
mx.c
nntp/nntp.c
notmuch/mutt_notmuch.c
pop/pop.c

index 6bf87743fb2e2842e1f71ef8b604791352f2e729..292f12bfe6915bcd480f9f41a1003ce8f6f6eb87 100644 (file)
@@ -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;
index b324f3b0e3df21ac68d22b04eb40a6cbd4a7612c..03b247ce850a0f8d961ca134b2b819f01f22413a 100644 (file)
@@ -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 62ba7afc2e64dd279e2d09ed774e7f8f4ce46d25..dde74c5ef9c6c365322625cd1161da5779c93ae0 100644 (file)
--- 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]];
index c323885add0e2049b5e8c67cee53baa9632977e9..e8ab1420a300a760205e587232651e0c1340e51e 100644 (file)
--- 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 */
 
index 02216035924099fa4b08b458ece93effa96570cb..767196c0c566c5d66bf0f462014e753c495f2059 100644 (file)
@@ -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;
index 099b03306e608641d965bba7dd995166f37b977c..dcdcf8578ceec635ff80fd9fcdedd8cce713c48c 100644 (file)
@@ -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 42b63fb5c79704ef2a139e87f920e80ee7c4e70b..6364d8beb4fe5c614460e6c34cb12823f673aa83 100644 (file)
--- 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;
index 85446333fad55f91bcab181e464a58d6c4cbb80b..daaaca4d6d22f3eb86e767f4c6ccdbc64b37d1d2 100644 (file)
@@ -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];
index dccdb8cba60a9c5fdd3d9ead560422945682c662..29d836d40bdd7114a00d94313ce51fcd5fe2c931 100644 (file)
@@ -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;
index cd16e78c4f67bd10f55e5204991c870d0d9afc6f..594c81d3a938402b2bd15675dfc1d401aaad8af2 100644 (file)
--- 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;