rename Email private data
authorRichard Russon <rich@flatcap.org>
Thu, 18 Oct 2018 20:09:58 +0000 (21:09 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 25 Oct 2018 20:31:24 +0000 (21:31 +0100)
email/email.c
email/email.h
hcache/serialize.c
imap/imap.c
imap/message.c
imap/message.h
nntp/nntp.c
nntp/nntp_private.h
notmuch/mutt_notmuch.c
pop/pop.c
pop/pop_lib.c

index 4c156a6ec2751cd55444fc251b9b76ce9bec86a1..eebfc371a2a80a9ee9d145973aa234b10360b40e 100644 (file)
@@ -51,8 +51,8 @@ void mutt_email_free(struct Email **e)
   mutt_list_free(&(*e)->chain);
 #endif
   driver_tags_free(&(*e)->tags);
-  if ((*e)->data && (*e)->free_data)
-    (*e)->free_data(&(*e)->data);
+  if ((*e)->edata && (*e)->free_edata)
+    (*e)->free_edata(&(*e)->edata);
   FREE(e);
 }
 
index 6c283d13051c37c1fadd4c859c5ac8c686ade5bf..1d585514950fbbbccf54ef6d2b05daa8bc8a4004 100644 (file)
@@ -108,10 +108,10 @@ struct Email
 
   struct TagHead tags; /**< for drivers that support server tagging */
 
-  void *data;                 /**< driver-specific data */
-  void (*free_data)(void **); /**< driver-specific data free function */
-
   char *maildir_flags; /**< unknown maildir flags */
+
+  void *edata;                 /**< driver-specific data */
+  void (*free_edata)(void **); /**< driver-specific data free function */
 };
 
 bool          mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2);
index b12a3a62fe8b4e255ad549d1f69ff9eefb91681c..bb220fc95cd6b8c1ac0710f6feaa053e05d647be 100644 (file)
@@ -615,7 +615,7 @@ void *mutt_hcache_dump(header_cache_t *hc, const struct Email *e, int *off, unsi
 #ifdef MIXMASTER
   STAILQ_INIT(&nh.chain);
 #endif
-  nh.data = NULL;
+  nh.edata = NULL;
 
   memcpy(d + *off, &nh, sizeof(struct Email));
   *off += sizeof(struct Email);
index 0e773467bf57617817077e857c2761ef2a07ba99..8a2b0c223e69aaa0f7bc3e1acdbf9b0307e53db0 100644 (file)
@@ -269,7 +269,7 @@ static int make_msg_set(struct ImapAccountData *adata, struct Buffer *buf,
  */
 static bool compare_flags_for_copy(struct Email *e)
 {
-  struct ImapEmailData *edata = e->data;
+  struct ImapEmailData *edata = e->edata;
 
   if (e->read != edata->read)
     return true;
@@ -876,7 +876,7 @@ void imap_expunge_mailbox(struct ImapAccountData *adata)
 
       mutt_hash_int_delete(adata->uid_hash, IMAP_EDATA(e)->uid, e);
 
-      imap_free_emaildata((void **) &e->data);
+      imap_free_emaildata((void **) &e->edata);
     }
     else
     {
index 037d7c8e9367978ba854258fb594e933913289ad..9c33bc04089df411d8f3b6e1f9772f318b9085c2 100644 (file)
@@ -748,7 +748,7 @@ static int read_headers_normal_eval_cache(struct ImapAccountData *adata,
         }
 
         /*  mailbox->hdrs[msgno]->received is restored from mutt_hcache_restore */
-        ctx->mailbox->hdrs[idx]->data = h.data;
+        ctx->mailbox->hdrs[idx]->edata = h.data;
         STAILQ_INIT(&ctx->mailbox->hdrs[idx]->tags);
         driver_tags_replace(&ctx->mailbox->hdrs[idx]->tags,
                             mutt_str_strdup(h.data->flags_remote));
@@ -817,8 +817,8 @@ static int read_headers_qresync_eval_cache(struct ImapAccountData *adata, char *
         mx_alloc_memory(ctx->mailbox);
 
       struct ImapEmailData *edata = new_emaildata();
-      e->data = edata;
-      e->free_data = imap_free_emaildata;
+      e->edata = edata;
+      e->free_edata = imap_free_emaildata;
 
       e->index = ctx->mailbox->msg_count;
       e->active = true;
@@ -1072,7 +1072,7 @@ static int read_headers_fetch_new(struct ImapAccountData *adata, unsigned int ms
         ctx->mailbox->hdrs[idx]->flagged = h.data->flagged;
         ctx->mailbox->hdrs[idx]->replied = h.data->replied;
         ctx->mailbox->hdrs[idx]->received = h.received;
-        ctx->mailbox->hdrs[idx]->data = (void *) (h.data);
+        ctx->mailbox->hdrs[idx]->edata = (void *) (h.data);
         STAILQ_INIT(&ctx->mailbox->hdrs[idx]->tags);
         driver_tags_replace(&ctx->mailbox->hdrs[idx]->tags,
                             mutt_str_strdup(h.data->flags_remote));
@@ -1730,7 +1730,7 @@ char *imap_set_flags(struct ImapAccountData *adata, struct Email *e, char *s, in
 
   local_changes = e->changed;
 
-  struct ImapEmailData *edata = e->data;
+  struct ImapEmailData *edata = e->edata;
   newh.data = edata;
 
   memcpy(&old_edata, edata, sizeof(old_edata));
index e7588144aa98c196cbd15606b60e6e23081ac2f3..f5826359c53c15fd3bfdd8590204b0d93324afec 100644 (file)
@@ -62,6 +62,6 @@ struct ImapHeader
   long content_length;
 };
 
-#define IMAP_EDATA(email) ((struct ImapEmailData *) ((email)->data))
+#define IMAP_EDATA(email) ((struct ImapEmailData *) ((email)->edata))
 
 #endif /* MUTT_IMAP_MESSAGE_H */
index 40e954f38a70574d95263085872bd6e86609cfab..ed021a6640a26be0fd31b5592afdd74c947ee51a 100644 (file)
@@ -1079,7 +1079,7 @@ static int parse_overview_line(char *line, void *data)
       e = mutt_hcache_restore(hdata);
       ctx->mailbox->hdrs[ctx->mailbox->msg_count] = e;
       mutt_hcache_free(fc->hc, &hdata);
-      e->data = NULL;
+      e->edata = NULL;
       e->read = false;
       e->old = false;
 
@@ -1110,8 +1110,8 @@ static int parse_overview_line(char *line, void *data)
     e->read = false;
     e->old = false;
     e->deleted = false;
-    e->data = new_emaildata();
-    e->free_data = free_emaildata;
+    e->edata = new_emaildata();
+    e->free_edata = free_emaildata;
     NNTP_EDATA(e)->article_num = anum;
     if (fc->restore)
       e->changed = true;
@@ -1250,7 +1250,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
       e = mutt_hcache_restore(hdata);
       ctx->mailbox->hdrs[ctx->mailbox->msg_count] = e;
       mutt_hcache_free(fc.hc, &hdata);
-      e->data = NULL;
+      e->edata = NULL;
 
       /* skip header marked as deleted in cache */
       if (e->deleted && !restore)
@@ -1333,8 +1333,8 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
     e->read = false;
     e->old = false;
     e->deleted = false;
-    e->data = new_emaildata();
-    e->free_data = free_emaildata;
+    e->edata = new_emaildata();
+    e->free_edata = free_emaildata;
     NNTP_EDATA(e)->article_num = current;
     if (restore)
       e->changed = true;
@@ -1513,7 +1513,7 @@ static int check_mailbox(struct Context *ctx)
           mutt_debug(2, "#1 mutt_hcache_fetch %s\n", buf);
           e = mutt_hcache_restore(hdata);
           mutt_hcache_free(hc, &hdata);
-          e->data = NULL;
+          e->edata = NULL;
           deleted = e->deleted;
           flagged = e->flagged;
           mutt_email_free(&e);
@@ -1561,7 +1561,7 @@ static int check_mailbox(struct Context *ctx)
         e = mutt_hcache_restore(hdata);
         ctx->mailbox->hdrs[ctx->mailbox->msg_count] = e;
         mutt_hcache_free(hc, &hdata);
-        e->data = NULL;
+        e->edata = NULL;
         if (e->deleted)
         {
           mutt_email_free(&e);
@@ -1576,8 +1576,8 @@ static int check_mailbox(struct Context *ctx)
         ctx->mailbox->msg_count++;
         e->read = false;
         e->old = false;
-        e->data = new_emaildata();
-        e->free_data = free_emaildata;
+        e->edata = new_emaildata();
+        e->free_edata = free_emaildata;
         NNTP_EDATA(e)->article_num = anum;
         nntp_article_status(ctx->mailbox, e, NULL, anum);
         if (!e->read)
@@ -2163,8 +2163,8 @@ int nntp_check_msgid(struct Context *ctx, const char *msgid)
     mx_alloc_memory(ctx->mailbox);
   ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_email_new();
   struct Email *e = ctx->mailbox->hdrs[ctx->mailbox->msg_count];
-  e->data = new_emaildata();
-  e->free_data = free_emaildata;
+  e->edata = new_emaildata();
+  e->free_edata = free_emaildata;
   e->env = mutt_rfc822_read_header(fp, e, false, false);
   mutt_file_fclose(&fp);
 
index cd52bfd94b7ea32148e48132611566ab5dcfa5d2..c80458c871ce46515e07be8202bc5cbbbb0b4cd2 100644 (file)
@@ -45,7 +45,7 @@ enum NntpStatus
   NNTP_BYE
 };
 
-#define NNTP_EDATA(email) ((struct NntpEmailData *) ((email)->data))
+#define NNTP_EDATA(email) ((struct NntpEmailData *) ((email)->edata))
 
 void nntp_acache_free(struct NntpMboxData *mdata);
 int  nntp_active_save_cache(struct NntpAccountData *adata);
index c24fea1d601abc64c4597879bd6a036ec582d8c8..d859df1a1d0be0391df2630f13c7b320d3362573 100644 (file)
@@ -315,7 +315,7 @@ static int init_mailbox(struct Mailbox *mailbox)
  */
 static char *email_get_id(struct Email *e)
 {
-  return (e && e->data) ? ((struct NmEmailData *) e->data)->virtual_id : NULL;
+  return (e && e->edata) ? ((struct NmEmailData *) e->edata)->virtual_id : NULL;
 }
 
 /**
@@ -844,7 +844,7 @@ err:
  */
 static int update_email_tags(struct Email *e, notmuch_message_t *msg)
 {
-  struct NmEmailData *edata = e->data;
+  struct NmEmailData *edata = e->edata;
   char *new_tags = NULL;
   char *old_tags = NULL;
 
@@ -894,7 +894,7 @@ static int update_email_tags(struct Email *e, notmuch_message_t *msg)
  */
 static int update_message_path(struct Email *e, const char *path)
 {
-  struct NmEmailData *edata = e->data;
+  struct NmEmailData *edata = e->edata;
 
   mutt_debug(2, "nm: path update requested path=%s, (%s)\n", path, edata->virtual_id);
 
@@ -978,12 +978,12 @@ static char *nm2mutt_message_id(const char *id)
  */
 static int init_email(struct Email *e, const char *path, notmuch_message_t *msg)
 {
-  if (e->data)
+  if (e->edata)
     return 0;
 
   struct NmEmailData *edata = new_emaildata();
-  e->data = edata;
-  e->free_data = free_emaildata;
+  e->edata = edata;
+  e->free_edata = free_emaildata;
 
   /* Notmuch ensures that message Id exists (if not notmuch Notmuch will
    * generate an ID), so it's more safe than use neomutt Email->env->id
@@ -991,7 +991,7 @@ static int init_email(struct Email *e, const char *path, notmuch_message_t *msg)
   const char *id = notmuch_message_get_message_id(msg);
   edata->virtual_id = mutt_str_strdup(id);
 
-  mutt_debug(2, "nm: [e=%p, data=%p] (%s)\n", (void *) e, (void *) e->data, id);
+  mutt_debug(2, "nm: [e=%p, edata=%p] (%s)\n", (void *) e, (void *) e->edata, id);
 
   if (!e->env->message_id)
     e->env->message_id = nm2mutt_message_id(id);
@@ -1196,7 +1196,7 @@ static void append_message(struct Mailbox *mailbox, notmuch_query_t *q,
   if (newpath)
   {
     /* remember that file has been moved -- nm_mbox_sync() will update the DB */
-    struct NmEmailData *edata = e->data;
+    struct NmEmailData *edata = e->edata;
 
     if (edata)
     {
@@ -1768,7 +1768,7 @@ static unsigned int count_query(notmuch_database_t *db, const char *qstr)
  */
 char *nm_email_get_folder(struct Email *e)
 {
-  return (e && e->data) ? ((struct NmEmailData *) e->data)->folder : NULL;
+  return (e && e->edata) ? ((struct NmEmailData *) e->edata)->folder : NULL;
 }
 
 /**
@@ -2146,7 +2146,7 @@ int nm_update_filename(struct Mailbox *mailbox, const char *old,
   if (!mdata || !new)
     return -1;
 
-  if (!old && e && e->data)
+  if (!old && e && e->edata)
   {
     email_get_fullpath(e, buf, sizeof(buf));
     old = buf;
@@ -2599,7 +2599,7 @@ static int nm_mbox_sync(struct Context *ctx, int *index_hint)
   {
     char old[PATH_MAX], new[PATH_MAX];
     struct Email *e = ctx->mailbox->hdrs[i];
-    struct NmEmailData *edata = e->data;
+    struct NmEmailData *edata = e->edata;
 
     if (!ctx->mailbox->quiet)
       mutt_progress_update(&progress, i, -1);
index 1e017c1868aa2d82beb2bbcdc7854aad85110fc2..d7b43fc917a176c3d9986ae8499cdb25c3b98f7a 100644 (file)
--- a/pop/pop.c
+++ b/pop/pop.c
@@ -274,7 +274,7 @@ static int fetch_uidl(char *line, void *data)
   int i;
   for (i = 0; i < mailbox->msg_count; i++)
   {
-    struct PopEmailData *edata = mailbox->hdrs[i]->data;
+    struct PopEmailData *edata = mailbox->hdrs[i]->edata;
     if (mutt_str_strcmp(line, edata->uid) == 0)
       break;
   }
@@ -289,8 +289,8 @@ static int fetch_uidl(char *line, void *data)
     mailbox->msg_count++;
     mailbox->hdrs[i] = mutt_email_new();
 
-    mailbox->hdrs[i]->data = new_emaildata(line);
-    mailbox->hdrs[i]->free_data = free_emaildata;
+    mailbox->hdrs[i]->edata = new_emaildata(line);
+    mailbox->hdrs[i]->free_edata = free_emaildata;
   }
   else if (mailbox->hdrs[i]->index != index - 1)
     mdata->clear_cache = true;
@@ -322,7 +322,7 @@ static int msg_cache_check(const char *id, struct BodyCache *bcache, void *data)
 
   for (int i = 0; i < mailbox->msg_count; i++)
   {
-    struct PopEmailData *edata = mailbox->hdrs[i]->data;
+    struct PopEmailData *edata = mailbox->hdrs[i]->edata;
     /* if the id we get is known for a header: done (i.e. keep in cache) */
     if (edata->uid && (mutt_str_strcmp(edata->uid, id) == 0))
       return 0;
@@ -441,13 +441,13 @@ static int pop_fetch_headers(struct Context *ctx)
     {
       if (!ctx->mailbox->quiet)
         mutt_progress_update(&progress, i + 1 - old_count, -1);
-      struct PopEmailData *edata = ctx->mailbox->hdrs[i]->data;
+      struct PopEmailData *edata = ctx->mailbox->hdrs[i]->edata;
 #ifdef USE_HCACHE
       void *data = mutt_hcache_fetch(hc, edata->uid, strlen(edata->uid));
       if (data)
       {
         /* Detach the private data */
-        ctx->mailbox->hdrs[i]->data = NULL;
+        ctx->mailbox->hdrs[i]->edata = NULL;
 
         int refno = ctx->mailbox->hdrs[i]->refno;
         int index = ctx->mailbox->hdrs[i]->index;
@@ -467,8 +467,8 @@ static int pop_fetch_headers(struct Context *ctx)
         ctx->mailbox->hdrs[i]->index = index;
 
         /* Reattach the private data */
-        ctx->mailbox->hdrs[i]->data = edata;
-        ctx->mailbox->hdrs[i]->free_data = free_emaildata;
+        ctx->mailbox->hdrs[i]->edata = edata;
+        ctx->mailbox->hdrs[i]->free_edata = free_emaildata;
         ret = 0;
         hcached = true;
       }
@@ -873,7 +873,7 @@ static int pop_mbox_sync(struct Context *ctx, int *index_hint)
 
     for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->mailbox->msg_count; i++)
     {
-      struct PopEmailData *edata = ctx->mailbox->hdrs[i]->data;
+      struct PopEmailData *edata = ctx->mailbox->hdrs[i]->edata;
       if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->refno != -1)
       {
         j++;
@@ -961,7 +961,7 @@ static int pop_msg_open(struct Context *ctx, struct Message *msg, int msgno)
   struct Progress progressbar;
   struct PopMboxData *mdata = pop_get_mdata(ctx->mailbox);
   struct Email *e = ctx->mailbox->hdrs[msgno];
-  struct PopEmailData *edata = e->data;
+  struct PopEmailData *edata = e->edata;
   bool bcache = true;
 
   /* see if we already have the message in body cache */
@@ -1065,7 +1065,7 @@ static int pop_msg_open(struct Context *ctx, struct Message *msg, int msgno)
   rewind(msg->fp);
 
   /* Detach the private data */
-  e->data = NULL;
+  e->edata = NULL;
 
   /* we replace envelope, key in subj_hash has to be updated as well */
   if (ctx->mailbox->subj_hash && e->env->real_subj)
@@ -1078,8 +1078,8 @@ static int pop_msg_open(struct Context *ctx, struct Message *msg, int msgno)
   mutt_label_hash_add(ctx->mailbox, e);
 
   /* Reattach the private data */
-  e->data = edata;
-  e->free_data = free_emaildata;
+  e->edata = edata;
+  e->free_edata = free_emaildata;
 
   e->lines = 0;
   fgets(buf, sizeof(buf), msg->fp);
index 73d85612d0a028dcce3882ff387ee480f35039f6..fb906f6c082c5e14957773d0cadc39830949895b 100644 (file)
@@ -588,7 +588,7 @@ static int check_uidl(char *line, void *data)
   struct Mailbox *mailbox = data;
   for (int i = 0; i < mailbox->msg_count; i++)
   {
-    struct PopEmailData *edata = mailbox->hdrs[i]->data;
+    struct PopEmailData *edata = mailbox->hdrs[i]->edata;
     if (mutt_str_strcmp(edata->uid, line) == 0)
     {
       mailbox->hdrs[i]->refno = index;