]> granicus.if.org Git - neomutt/commitdiff
mxapi: unify naming
authorRichard Russon <rich@flatcap.org>
Mon, 22 Oct 2018 08:57:47 +0000 (09:57 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 25 Oct 2018 20:33:13 +0000 (21:33 +0100)
mailbox.c
mailbox.h
monitor.c
mutt_header.c
mutt_header.h
mutt_thread.c
mutt_thread.h
mx.c
mx.h

index d6fb9d2947e2a04b6d511af2270f451a7c6a548a..bc72b2932e0b025d0dc233330af674e2bfccfbfc 100644 (file)
--- a/mailbox.c
+++ b/mailbox.c
@@ -76,23 +76,6 @@ static short MailboxNotify = 0; /**< # of unnotified new boxes */
 
 struct MailboxList AllMailboxes = STAILQ_HEAD_INITIALIZER(AllMailboxes);
 
-/**
- * get_mailbox_description - Find a mailbox's description given a path.
- * @param path Path to the mailbox
- * @retval ptr Description
- * @retval NULL No mailbox matching path
- */
-static char *get_mailbox_description(const char *path)
-{
-  struct MailboxNode *np = NULL;
-  STAILQ_FOREACH(np, &AllMailboxes, entries)
-  {
-    if (np->m->desc && (strcmp(np->m->path, path) == 0))
-      return np->m->desc;
-  }
-  return NULL;
-}
-
 /**
  * mailbox_new - Create a new Mailbox
  * @param path Path to the mailbox
@@ -100,44 +83,44 @@ static char *get_mailbox_description(const char *path)
  */
 struct Mailbox *mailbox_new(const char *path)
 {
-  char rp[PATH_MAX] = "";
+  // char rp[PATH_MAX] = "";
 
-  struct Mailbox *mailbox = mutt_mem_calloc(1, sizeof(struct Mailbox));
-  mutt_str_strfcpy(mailbox->path, path, sizeof(mailbox->path));
-  char *r = realpath(path, rp);
-  mutt_str_strfcpy(mailbox->realpath, r ? rp : path, sizeof(mailbox->realpath));
-  mailbox->magic = MUTT_UNKNOWN;
-  mailbox->desc = get_mailbox_description(mailbox->path);
+  struct Mailbox *m = mutt_mem_calloc(1, sizeof(struct Mailbox));
+  // mutt_str_strfcpy(m->path, path, sizeof(m->path));
+  // char *r = realpath(path, rp);
+  // mutt_str_strfcpy(m->realpath, r ? rp : path, sizeof(m->realpath));
+  // m->magic = MUTT_UNKNOWN;
+  // m->desc = get_mailbox_description(m->path);
 
-  return mailbox;
+  return m;
 }
 
 /**
  * mailbox_free - Free a Mailbox
- * @param mailbox Mailbox to free
+ * @param m Mailbox to free
  */
-void mailbox_free(struct Mailbox **mailbox)
+void mailbox_free(struct Mailbox **m)
 {
-  if (!mailbox || !*mailbox)
+  if (!m || !*m)
     return;
 
-  FREE(&(*mailbox)->desc);
-  if ((*mailbox)->mdata && (*mailbox)->free_mdata)
-    (*mailbox)->free_mdata(&(*mailbox)->mdata);
-  FREE(mailbox);
+  FREE(&(*m)->desc);
+  if ((*m)->mdata && (*m)->free_mdata)
+    (*m)->free_mdata(&(*m)->mdata);
+  FREE(m);
 }
 
 /**
  * mailbox_maildir_check_dir - Check for new mail / mail counts
- * @param mailbox     Mailbox to check
- * @param dir_name    Path to mailbox
+ * @param m           Mailbox to check
+ * @param dir_name    Path to Mailbox
  * @param check_new   if true, check for new mail
  * @param check_stats if true, count total, new, and flagged messages
  * @retval 1 if the dir has new mail
  *
  * Checks the specified maildir subdir (cur or new) for new mail or mail counts.
  */
-static int mailbox_maildir_check_dir(struct Mailbox *mailbox, const char *dir_name,
+static int mailbox_maildir_check_dir(struct Mailbox *m, const char *dir_name,
                                      bool check_new, bool check_stats)
 {
   DIR *dirp = NULL;
@@ -148,15 +131,15 @@ static int mailbox_maildir_check_dir(struct Mailbox *mailbox, const char *dir_na
 
   struct Buffer *path = mutt_buffer_pool_get();
   struct Buffer *msgpath = mutt_buffer_pool_get();
-  mutt_buffer_printf(path, "%s/%s", mailbox->path, dir_name);
+  mutt_buffer_printf(path, "%s/%s", m->path, dir_name);
 
   /* when $mail_check_recent is set, if the new/ directory hasn't been modified since
-   * the user last exited the mailbox, then we know there is no recent mail.
+   * the user last exited the m, then we know there is no recent mail.
    */
   if (check_new && MailCheckRecent)
   {
     if (stat(mutt_b2s(path), &sb) == 0 &&
-        mutt_stat_timespec_compare(&sb, MUTT_STAT_MTIME, &mailbox->last_visited) < 0)
+        mutt_stat_timespec_compare(&sb, MUTT_STAT_MTIME, &m->last_visited) < 0)
     {
       rc = 0;
       check_new = false;
@@ -169,7 +152,7 @@ static int mailbox_maildir_check_dir(struct Mailbox *mailbox, const char *dir_na
   dirp = opendir(mutt_b2s(path));
   if (!dirp)
   {
-    mailbox->magic = MUTT_UNKNOWN;
+    m->magic = MUTT_UNKNOWN;
     rc = 0;
     goto cleanup;
   }
@@ -185,27 +168,27 @@ static int mailbox_maildir_check_dir(struct Mailbox *mailbox, const char *dir_na
 
     if (check_stats)
     {
-      mailbox->msg_count++;
+      m->msg_count++;
       if (p && strchr(p + 3, 'F'))
-        mailbox->msg_flagged++;
+        m->msg_flagged++;
     }
     if (!p || !strchr(p + 3, 'S'))
     {
       if (check_stats)
-        mailbox->msg_unread++;
+        m->msg_unread++;
       if (check_new)
       {
         if (MailCheckRecent)
         {
           mutt_buffer_printf(msgpath, "%s/%s", mutt_b2s(path), de->d_name);
-          /* ensure this message was received since leaving this mailbox */
+          /* ensure this message was received since leaving this m */
           if (stat(mutt_b2s(msgpath), &sb) == 0 &&
-              (mutt_stat_timespec_compare(&sb, MUTT_STAT_CTIME, &mailbox->last_visited) <= 0))
+              (mutt_stat_timespec_compare(&sb, MUTT_STAT_CTIME, &m->last_visited) <= 0))
           {
             continue;
           }
         }
-        mailbox->has_new = true;
+        m->has_new = true;
         rc = 1;
         check_new = false;
         if (!check_stats)
@@ -225,27 +208,27 @@ cleanup:
 
 /**
  * mailbox_maildir_check - Check for new mail in a maildir mailbox
- * @param mailbox     Mailbox to check
+ * @param m           Mailbox to check
  * @param check_stats if true, also count total, new, and flagged messages
  * @retval 1 if the mailbox has new mail
  */
-static int mailbox_maildir_check(struct Mailbox *mailbox, bool check_stats)
+static int mailbox_maildir_check(struct Mailbox *m, bool check_stats)
 {
   int rc = 1;
   bool check_new = true;
 
   if (check_stats)
   {
-    mailbox->msg_count = 0;
-    mailbox->msg_unread = 0;
-    mailbox->msg_flagged = 0;
+    m->msg_count = 0;
+    m->msg_unread = 0;
+    m->msg_flagged = 0;
   }
 
-  rc = mailbox_maildir_check_dir(mailbox, "new", check_new, check_stats);
+  rc = mailbox_maildir_check_dir(m, "new", check_new, check_stats);
 
   check_new = !rc && MaildirCheckCur;
   if (check_new || check_stats)
-    if (mailbox_maildir_check_dir(mailbox, "cur", check_new, check_stats))
+    if (mailbox_maildir_check_dir(m, "cur", check_new, check_stats))
       rc = 1;
 
   return rc;
@@ -253,23 +236,23 @@ static int mailbox_maildir_check(struct Mailbox *mailbox, bool check_stats)
 
 /**
  * mailbox_mbox_check - Check for new mail for an mbox mailbox
- * @param mailbox     Mailbox to check
+ * @param m           Mailbox to check
  * @param sb          stat(2) information about the mailbox
  * @param check_stats if true, also count total, new, and flagged messages
  * @retval 1 if the mailbox has new mail
  */
-static int mailbox_mbox_check(struct Mailbox *mailbox, struct stat *sb, bool check_stats)
+static int mailbox_mbox_check(struct Mailbox *m, struct stat *sb, bool check_stats)
 {
   int rc = 0;
   bool new_or_changed;
 
   if (CheckMboxSize)
-    new_or_changed = (sb->st_size > mailbox->size);
+    new_or_changed = (sb->st_size > m->size);
   else
   {
     new_or_changed =
         (mutt_stat_compare(sb, MUTT_STAT_MTIME, sb, MUTT_STAT_ATIME) > 0) ||
-        (mailbox->newly_created &&
+        (m->newly_created &&
          (mutt_stat_compare(sb, MUTT_STAT_CTIME, sb, MUTT_STAT_MTIME) == 0) &&
          (mutt_stat_compare(sb, MUTT_STAT_CTIME, sb, MUTT_STAT_ATIME) == 0));
   }
@@ -277,32 +260,32 @@ static int mailbox_mbox_check(struct Mailbox *mailbox, struct stat *sb, bool che
   if (new_or_changed)
   {
     if (!MailCheckRecent ||
-        (mutt_stat_timespec_compare(sb, MUTT_STAT_MTIME, &mailbox->last_visited) > 0))
+        (mutt_stat_timespec_compare(sb, MUTT_STAT_MTIME, &m->last_visited) > 0))
     {
       rc = 1;
-      mailbox->has_new = true;
+      m->has_new = true;
     }
   }
   else if (CheckMboxSize)
   {
     /* some other program has deleted mail from the folder */
-    mailbox->size = (off_t) sb->st_size;
+    m->size = (off_t) sb->st_size;
   }
 
-  if (mailbox->newly_created && (sb->st_ctime != sb->st_mtime || sb->st_ctime != sb->st_atime))
-    mailbox->newly_created = false;
+  if (m->newly_created && (sb->st_ctime != sb->st_mtime || sb->st_ctime != sb->st_atime))
+    m->newly_created = false;
 
   if (check_stats &&
-      (mutt_stat_timespec_compare(sb, MUTT_STAT_MTIME, &mailbox->stats_last_checked) > 0))
+      (mutt_stat_timespec_compare(sb, MUTT_STAT_MTIME, &m->stats_last_checked) > 0))
   {
     struct Context *ctx =
-        mx_mbox_open(mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK);
+        mx_mbox_open(m->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK);
     if (ctx)
     {
-      mailbox->msg_count = ctx->mailbox->msg_count;
-      mailbox->msg_unread = ctx->mailbox->msg_unread;
-      mailbox->msg_flagged = ctx->mailbox->msg_flagged;
-      mailbox->stats_last_checked = ctx->mailbox->mtime;
+      m->msg_count = ctx->mailbox->msg_count;
+      m->msg_unread = ctx->mailbox->msg_unread;
+      m->msg_flagged = ctx->mailbox->msg_flagged;
+      m->stats_last_checked = ctx->mailbox->mtime;
       mx_mbox_close(&ctx, NULL);
     }
   }
@@ -857,16 +840,16 @@ bool mutt_mailbox_list(void)
  */
 void mutt_mailbox_setnotified(const char *path)
 {
-  struct Mailbox *mailbox = mailbox_get(path);
-  if (!mailbox)
+  struct Mailbox *m = mailbox_get(path);
+  if (!m)
     return;
 
-  mailbox->notified = true;
+  m->notified = true;
 #if HAVE_CLOCK_GETTIME
-  clock_gettime(CLOCK_REALTIME, &mailbox->last_visited);
+  clock_gettime(CLOCK_REALTIME, &m->last_visited);
 #else
-  mailbox->last_visited.tv_nsec = 0;
-  time(&mailbox->last_visited.tv_sec);
+  m->last_visited.tv_nsec = 0;
+  time(&m->last_visited.tv_sec);
 #endif
 }
 
index d2807b6c40d8aa6d2a72152b3295b52091ebaef5..2017de0e8a0e0a0b1fd6defd2e287875638f260a 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -139,7 +139,7 @@ void mutt_mailbox_vfolder(char *buf, size_t buflen);
 #endif
 
 struct Mailbox *mailbox_new(const char *path);
-void            mailbox_free(struct Mailbox **mailbox);
+void            mailbox_free(struct Mailbox **m);
 void            mutt_context_free(struct Context **ctx);
 
 struct Mailbox *mutt_find_mailbox(const char *path);
index 8e7f72be68241fce3825f201747bcd79683e62d1..c5fa9fd629dd696f9796b20325e3c45f45623240 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -271,26 +271,26 @@ static int monitor_handle_ignore(int desc)
 
 /**
  * monitor_resolve - Get the monitor for a mailbox
- * @param[out] info    Details of the mailbox's monitor
- * @param[in]  mailbox Mailbox
+ * @param[out] info Details of the mailbox's monitor
+ * @param[in]  m    Mailbox
  * @retval >=0 mailbox is valid and locally accessible:
  *               0: no monitor / 1: preexisting monitor
  * @retval  -3 no mailbox (MonitorInfo: no fields set)
  * @retval  -2 magic not set
  * @retval  -1 stat() failed (see errno; MonitorInfo fields: magic, isdir, path)
  *
- * If mailbox is NULL, the current mailbox (Context) is used.
+ * If m is NULL, the current mailbox (Context) is used.
  */
-static int monitor_resolve(struct MonitorInfo *info, struct Mailbox *mailbox)
+static int monitor_resolve(struct MonitorInfo *info, struct Mailbox *m)
 {
   struct Monitor *iter;
   char *fmt = NULL;
   struct stat sb;
 
-  if (mailbox)
+  if (m)
   {
-    info->magic = mailbox->magic;
-    info->path = mailbox->realpath;
+    info->magic = m->magic;
+    info->path = m->realpath;
   }
   else if (Context)
   {
@@ -425,20 +425,20 @@ int mutt_monitor_poll(void)
 
 /**
  * mutt_monitor_add - Add a watch for a mailbox
- * @param mailbox Mailbox to watch
+ * @param m Mailbox to watch
  * @retval  0 success: new or already existing monitor
  * @retval -1 failed:  no mailbox, inaccessible file, create monitor/watcher failed
  *
  * If mailbox is NULL, the current mailbox (Context) is used.
  */
-int mutt_monitor_add(struct Mailbox *mailbox)
+int mutt_monitor_add(struct Mailbox *m)
 {
   struct MonitorInfo info;
 
-  int desc = monitor_resolve(&info, mailbox);
+  int desc = monitor_resolve(&info, m);
   if (desc != RESOLVERES_OK_NOTEXISTING)
   {
-    if (!mailbox && (desc == RESOLVERES_OK_EXISTING))
+    if (!m && (desc == RESOLVERES_OK_EXISTING))
       MonitorContextDescriptor = info.monitor->desc;
     return (desc == RESOLVERES_OK_EXISTING) ? 0 : -1;
   }
@@ -453,7 +453,7 @@ int mutt_monitor_add(struct Mailbox *mailbox)
   }
 
   mutt_debug(3, "inotify_add_watch descriptor=%d for '%s'\n", desc, info.path);
-  if (!mailbox)
+  if (!m)
     MonitorContextDescriptor = desc;
 
   monitor_create(&info, desc);
@@ -462,29 +462,29 @@ int mutt_monitor_add(struct Mailbox *mailbox)
 
 /**
  * mutt_monitor_remove - Remove a watch for a mailbox
- * @param mailbox Mailbox
+ * @param m Mailbox
  * @retval 0 monitor removed (not shared)
  * @retval 1 monitor not removed (shared)
  * @retval 2 no monitor
  *
  * If mailbox is NULL, the current mailbox (Context) is used.
  */
-int mutt_monitor_remove(struct Mailbox *mailbox)
+int mutt_monitor_remove(struct Mailbox *m)
 {
   struct MonitorInfo info, info2;
 
-  if (!mailbox)
+  if (!m)
   {
     MonitorContextDescriptor = -1;
     MonitorContextChanged = 0;
   }
 
-  if (monitor_resolve(&info, mailbox) != RESOLVERES_OK_EXISTING)
+  if (monitor_resolve(&info, m) != RESOLVERES_OK_EXISTING)
     return 2;
 
   if (Context)
   {
-    if (mailbox)
+    if (m)
     {
       if ((monitor_resolve(&info2, NULL) == RESOLVERES_OK_EXISTING) &&
           (info.st_ino == info2.st_ino) && (info.st_dev == info2.st_dev))
index 68abba5a3de404f03a95559c63b5fc704b5e5db6..2bc99dc28393a19384edadd89b74e0420bf397eb 100644 (file)
 
 /**
  * label_ref_dec - Decrease the refcount of a label
- * @param mailbox   Mailbox
+ * @param m     Mailbox
  * @param label Label
  */
-static void label_ref_dec(struct Mailbox *mailbox, char *label)
+static void label_ref_dec(struct Mailbox *m, char *label)
 {
-  struct HashElem *elem = mutt_hash_find_elem(mailbox->label_hash, label);
+  struct HashElem *elem = mutt_hash_find_elem(m->label_hash, label);
   if (!elem)
     return;
 
   uintptr_t count = (uintptr_t) elem->data;
   if (count <= 1)
   {
-    mutt_hash_delete(mailbox->label_hash, label, NULL);
+    mutt_hash_delete(m->label_hash, label, NULL);
     return;
   }
 
@@ -66,18 +66,18 @@ static void label_ref_dec(struct Mailbox *mailbox, char *label)
 
 /**
  * label_ref_inc - Increase the refcount of a label
- * @param mailbox   Mailbox
+ * @param m     Mailbox
  * @param label Label
  */
-static void label_ref_inc(struct Mailbox *mailbox, char *label)
+static void label_ref_inc(struct Mailbox *m, char *label)
 {
   uintptr_t count;
 
-  struct HashElem *elem = mutt_hash_find_elem(mailbox->label_hash, label);
+  struct HashElem *elem = mutt_hash_find_elem(m->label_hash, label);
   if (!elem)
   {
     count = 1;
-    mutt_hash_insert(mailbox->label_hash, label, (void *) count);
+    mutt_hash_insert(m->label_hash, label, (void *) count);
     return;
   }
 
@@ -88,12 +88,12 @@ static void label_ref_inc(struct Mailbox *mailbox, char *label)
 
 /**
  * label_message - add an X-Label: field
- * @param[in]  mailbox Mailbox
- * @param[in]  e Email
+ * @param[in]  m   Mailbox
+ * @param[in]  e   Email
  * @param[out] new Set to true if this is a new label
  * @retval true If the label was added
  */
-static bool label_message(struct Mailbox *mailbox, struct Email *e, char *new)
+static bool label_message(struct Mailbox *m, struct Email *e, char *new)
 {
   if (!e)
     return false;
@@ -101,10 +101,10 @@ static bool label_message(struct Mailbox *mailbox, struct Email *e, char *new)
     return false;
 
   if (e->env->x_label)
-    label_ref_dec(mailbox, e->env->x_label);
+    label_ref_dec(m, e->env->x_label);
   mutt_str_replace(&e->env->x_label, new);
   if (e->env->x_label)
-    label_ref_inc(mailbox, e->env->x_label);
+    label_ref_inc(m, e->env->x_label);
 
   e->changed = true;
   e->xlabel_changed = true;
@@ -365,38 +365,38 @@ void mutt_edit_headers(const char *editor, const char *body, struct Email *msg,
 
 /**
  * mutt_make_label_hash - Create a Hash Table to store the labels
- * @param mailbox Mailbox
+ * @param m Mailbox
  */
-void mutt_make_label_hash(struct Mailbox *mailbox)
+void mutt_make_label_hash(struct Mailbox *m)
 {
   /* 131 is just a rough prime estimate of how many distinct
-   * labels someone might have in a mailbox.
+   * labels someone might have in a m.
    */
-  mailbox->label_hash = mutt_hash_create(131, MUTT_HASH_STRDUP_KEYS);
+  m->label_hash = mutt_hash_create(131, MUTT_HASH_STRDUP_KEYS);
 }
 
 /**
  * mutt_label_hash_add - Add a message's labels to the Hash Table
- * @param mailbox Mailbox
+ * @param m Mailbox
  * @param e Header of message
  */
-void mutt_label_hash_add(struct Mailbox *mailbox, struct Email *e)
+void mutt_label_hash_add(struct Mailbox *m, struct Email *e)
 {
-  if (!mailbox || !mailbox->label_hash)
+  if (!m || !m->label_hash)
     return;
   if (e->env->x_label)
-    label_ref_inc(mailbox, e->env->x_label);
+    label_ref_inc(m, e->env->x_label);
 }
 
 /**
  * mutt_label_hash_remove - Rmove a message's labels from the Hash Table
- * @param mailbox Mailbox
+ * @param m Mailbox
  * @param e Header of message
  */
-void mutt_label_hash_remove(struct Mailbox *mailbox, struct Email *e)
+void mutt_label_hash_remove(struct Mailbox *m, struct Email *e)
 {
-  if (!mailbox || !mailbox->label_hash)
+  if (!m || !m->label_hash)
     return;
   if (e->env->x_label)
-    label_ref_dec(mailbox, e->env->x_label);
+    label_ref_dec(m, e->env->x_label);
 }
index 1e9fed05709c6c8b6a07aa4d123320289716784e..74951e54a3d8d303ba9b4a0dc3a8ca2f95a07a4f 100644 (file)
@@ -29,9 +29,9 @@ struct Context;
 struct Email;
 
 void mutt_edit_headers(const char *editor, const char *body, struct Email *msg, char *fcc, size_t fcclen);
-void mutt_label_hash_add(struct Mailbox *mailbox, struct Email *e);
-void mutt_label_hash_remove(struct Mailbox *mailbox, struct Email *e);
+void mutt_label_hash_add(struct Mailbox *m, struct Email *e);
+void mutt_label_hash_remove(struct Mailbox *m, struct Email *e);
 int  mutt_label_message(struct Email *e);
-void mutt_make_label_hash(struct Mailbox *mailbox);
+void mutt_make_label_hash(struct Mailbox *m);
 
 #endif /* MUTT_MUTT_HEADER_H */
index b8cae09532b75dcf082e4a52854fae8597a9cc0c..0fa8112cafe94771de51710b04f38afb6e9f3044 100644 (file)
@@ -1391,16 +1391,16 @@ int mutt_messages_in_thread(struct Context *ctx, struct Email *e, int flag)
 
 /**
  * mutt_make_id_hash - Create a Hash Table for message-ids
- * @param mailbox Mailbox
+ * @param m Mailbox
  * @retval ptr Newly allocated Hash Table
  */
-struct Hash *mutt_make_id_hash(struct Mailbox *mailbox)
+struct Hash *mutt_make_id_hash(struct Mailbox *m)
 {
-  struct Hash *hash = mutt_hash_create(mailbox->msg_count * 2, 0);
+  struct Hash *hash = mutt_hash_create(m->msg_count * 2, 0);
 
-  for (int i = 0; i < mailbox->msg_count; i++)
+  for (int i = 0; i < m->msg_count; i++)
   {
-    struct Email *e = mailbox->hdrs[i];
+    struct Email *e = m->hdrs[i];
     if (e->env->message_id)
       mutt_hash_insert(hash, e->env->message_id, e);
   }
index 3a678484b5f77aa0b6ea930e536e335adcdb2467..8ea4ae39de9199a5f96bd4dff4fae16159687994 100644 (file)
@@ -72,6 +72,6 @@ struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, bool init);
 void mutt_sort_threads(struct Context *ctx, bool init);
 int mutt_parent_message(struct Context *ctx, struct Email *e, bool find_root);
 void mutt_set_virtual(struct Context *ctx);
-struct Hash *mutt_make_id_hash(struct Mailbox *mailbox);
+struct Hash *mutt_make_id_hash(struct Mailbox *m);
 
 #endif /* MUTT_MUTT_THREAD_H */
diff --git a/mx.c b/mx.c
index 2fbb19f257d46b21895ec1643fb9b6fd7d2d7a28..290f9d78d6824fbccd8586aaeb623dcefcc18ccd 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1146,32 +1146,32 @@ int mx_msg_close(struct Context *ctx, struct Message **msg)
 
 /**
  * mx_alloc_memory - Create storage for the emails
- * @param mailbox Mailbox
+ * @param m Mailbox
  */
-void mx_alloc_memory(struct Mailbox *mailbox)
+void mx_alloc_memory(struct Mailbox *m)
 {
   size_t s = MAX(sizeof(struct Email *), sizeof(int));
 
-  if ((mailbox->hdrmax + 25) * s < mailbox->hdrmax * s)
+  if ((m->hdrmax + 25) * s < m->hdrmax * s)
   {
     mutt_error(_("Out of memory"));
     mutt_exit(1);
   }
 
-  if (mailbox->hdrs)
+  if (m->hdrs)
   {
-    mutt_mem_realloc(&mailbox->hdrs, sizeof(struct Email *) * (mailbox->hdrmax += 25));
-    mutt_mem_realloc(&mailbox->v2r, sizeof(int) * mailbox->hdrmax);
+    mutt_mem_realloc(&m->hdrs, sizeof(struct Email *) * (m->hdrmax += 25));
+    mutt_mem_realloc(&m->v2r, sizeof(int) * m->hdrmax);
   }
   else
   {
-    mailbox->hdrs = mutt_mem_calloc((mailbox->hdrmax += 25), sizeof(struct Email *));
-    mailbox->v2r = mutt_mem_calloc(mailbox->hdrmax, sizeof(int));
+    m->hdrs = mutt_mem_calloc((m->hdrmax += 25), sizeof(struct Email *));
+    m->v2r = mutt_mem_calloc(m->hdrmax, sizeof(int));
   }
-  for (int i = mailbox->msg_count; i < mailbox->hdrmax; i++)
+  for (int i = m->msg_count; i < m->hdrmax; i++)
   {
-    mailbox->hdrs[i] = NULL;
-    mailbox->v2r[i] = -1;
+    m->hdrs[i] = NULL;
+    m->v2r[i] = -1;
   }
 }
 
diff --git a/mx.h b/mx.h
index 513ab028b698ef4b0ce8a51fb937659caa2b650d..84213781c729c330bc51e5f60d6d2067c270e560 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -251,7 +251,7 @@ int             mx_tags_commit     (struct Context *ctx, struct Email *e, char *
 int             mx_tags_edit       (struct Context *ctx, const char *tags, char *buf, size_t buflen);
 
 int                 mx_access(const char *path, int flags);
-void                mx_alloc_memory(struct Mailbox *mailbox);
+void                mx_alloc_memory(struct Mailbox *m);
 int                 mx_check_empty(const char *path);
 int                 mx_check_mailbox(struct Context *ctx, int *index_hint);
 void                mx_fastclose_mailbox(struct Context *ctx);