]> granicus.if.org Git - neomutt/commitdiff
standardise the envelope functions
authorRichard Russon <rich@flatcap.org>
Tue, 28 Nov 2017 19:25:12 +0000 (19:25 +0000)
committerRichard Russon <rich@flatcap.org>
Wed, 29 Nov 2017 00:29:10 +0000 (00:29 +0000)
16 files changed:
buffy.c
envelope.c
envelope.h
hcache/hcache.c
hcache/hcache.h
header.c
imap/message.c
main.c
muttlib.c
nntp.c
parse.c
pop.c
postpone.c
query.c
recvcmd.c
send.c

diff --git a/buffy.c b/buffy.c
index 9fda5f744740d42d065c103c1a64d22406245902..db32d86b65e95801cf1dff32c312a064efa98fb8 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -129,7 +129,7 @@ static int test_last_status_new(FILE *f)
   if (!(hdr->read || hdr->old))
     result = 1;
 
-  mutt_free_envelope(&tmp_envelope);
+  mutt_env_free(&tmp_envelope);
   mutt_free_header(&hdr);
 
   return result;
index a65f2f38c2cf2acecd70ceada9b7fcec3685c7f0..6c229128c4a8e41f8a501e5427da7f89cf10afd9 100644 (file)
  *
  * Representation of an email header (envelope)
  *
- * | Function                     | Description
- * | :--------------------------- | :---------------------------------------------------------
- * | mutt_free_envelope           | Free an Envelope
- * | mutt_merge_envelopes         | Merge the headers of two Envelopes
- * | mutt_new_envelope            | Create a new Envelope
+ * | Function         | Description
+ * | :--------------- | :---------------------------------
+ * | mutt_env_free()  | Free an Envelope
+ * | mutt_env_merge() | Merge the headers of two Envelopes
+ * | mutt_env_new()   | Create a new Envelope
  */
 
 #include "config.h"
 #include "address.h"
 
 /**
- * mutt_new_envelope - Create a new Envelope
+ * mutt_env_new - Create a new Envelope
  * @retval ptr New Envelope
  */
-struct Envelope *mutt_new_envelope(void)
+struct Envelope *mutt_env_new(void)
 {
   struct Envelope *e = mutt_mem_calloc(1, sizeof(struct Envelope));
   STAILQ_INIT(&e->references);
@@ -54,10 +54,10 @@ struct Envelope *mutt_new_envelope(void)
 }
 
 /**
- * mutt_free_envelope - Free an Envelope
+ * mutt_env_free - Free an Envelope
  * @param p Envelope to free
  */
-void mutt_free_envelope(struct Envelope **p)
+void mutt_env_free(struct Envelope **p)
 {
   if (!*p)
     return;
@@ -95,17 +95,17 @@ void mutt_free_envelope(struct Envelope **p)
 }
 
 /**
- * mutt_merge_envelopes - Merge the headers of two Envelopes
+ * mutt_env_merge - Merge the headers of two Envelopes
  * @param base  Envelope destination for all the headers
  * @param extra Envelope to copy from
  *
  * Any fields that are missing from base will be copied from extra.
  * extra will be freed afterwards.
  */
-void mutt_merge_envelopes(struct Envelope *base, struct Envelope **extra)
+void mutt_env_merge(struct Envelope *base, struct Envelope **extra)
 {
 /* copies each existing element if necessary, and sets the element
- * to NULL in the source so that mutt_free_envelope doesn't leave us
+ * to NULL in the source so that mutt_env_free doesn't leave us
  * with dangling pointers. */
 #define MOVE_ELEM(h)                                                           \
   if (!base->h)                                                                \
@@ -161,5 +161,5 @@ void mutt_merge_envelopes(struct Envelope *base, struct Envelope **extra)
   MOVE_STAILQ(userhdrs);
 #undef MOVE_ELEM
 
-  mutt_free_envelope(extra);
+  mutt_env_free(extra);
 }
index 2453224359f84f5e9bad857b7be32faac054acde..5d7e5f79c7f6ea659bf7ad22bf08f641c318be46 100644 (file)
@@ -64,8 +64,8 @@ struct Envelope
   bool refs_changed : 1; /**< References changed to break thread */
 };
 
-struct Envelope *mutt_new_envelope(void);
-void mutt_free_envelope(struct Envelope **p);
-void mutt_merge_envelopes(struct Envelope *base, struct Envelope **extra);
+struct Envelope *mutt_env_new(void);
+void mutt_env_free(struct Envelope **p);
+void mutt_env_merge(struct Envelope *base, struct Envelope **extra);
 
 #endif /* _MUTT_ENVELOPE_H */
index e24356d18322365f8f93890a56ee44d54330dbf2..19d7d3ef61dac28b55fdb8911db20134c0b1dd83 100644 (file)
@@ -705,7 +705,7 @@ struct Header *mutt_hcache_restore(const unsigned char *d)
   memcpy(h, d + off, sizeof(struct Header));
   off += sizeof(struct Header);
 
-  h->env = mutt_new_envelope();
+  h->env = mutt_env_new();
   restore_envelope(h->env, d, &off, convert);
 
   h->content = mutt_new_body();
index 772d749abb91079aff9db7b98ffd443a5eb3c288..9a23666ddcd38692273ad1cbd7bafa31c37008aa 100644 (file)
@@ -44,7 +44,7 @@
  *   * mutt_convert_string()
  *   * mutt_encode_path()
  *   * mutt_new_body()
- *   * mutt_new_envelope()
+ *   * mutt_env_new()
  *   * mutt_sleep()
  *   * mx_lock_file()
  *   * mx_unlock_file()
index 214fb2727ae5da4dfabeea6a2ea932b10e0b3ed4..95dc93e2eb44c895263a1f7299324552c2aab7f6 100644 (file)
--- a/header.c
+++ b/header.c
@@ -142,7 +142,7 @@ void mutt_edit_headers(const char *editor, const char *body, struct Header *msg,
   mutt_list_free(&n->references);
   STAILQ_SWAP(&n->references, &msg->env->references, ListNode);
 
-  mutt_free_envelope(&msg->env);
+  mutt_env_free(&msg->env);
   msg->env = n;
   n = NULL;
 
@@ -360,7 +360,7 @@ void mutt_free_header(struct Header **h)
 {
   if (!h || !*h)
     return;
-  mutt_free_envelope(&(*h)->env);
+  mutt_env_free(&(*h)->env);
   mutt_free_body(&(*h)->content);
   FREE(&(*h)->maildir_flags);
   FREE(&(*h)->tree);
index 4cafe9eb55ad0811d6a07dbe0cbab54f4d2c94b4..b7741328f1714f1ea6ce8c909bcc86929c0eed81 100644 (file)
@@ -1169,7 +1169,7 @@ parsemsg:
    * changed). Another possibility: ignore Status on IMAP? */
   read = h->read;
   newenv = mutt_read_rfc822_header(msg->fp, h, 0, 0);
-  mutt_merge_envelopes(h->env, &newenv);
+  mutt_env_merge(h->env, &newenv);
 
   /* see above. We want the new status in h->read, so we unset it manually
    * and let mutt_set_flag set it correctly, updating context. */
diff --git a/main.c b/main.c
index 6e0c3485e78b81da3ab5900e09d2d35d428dc3d7..b6b2d31d93905385d9d5d1696793864aacf94b0f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -302,7 +302,7 @@ int main(int argc, char **argv, char **env)
           if (!msg)
             msg = mutt_new_header();
           if (!msg->env)
-            msg->env = mutt_new_envelope();
+            msg->env = mutt_env_new();
           if (i == 'b')
             msg->env->bcc = mutt_addr_parse_list(msg->env->bcc, optarg);
           else
@@ -573,7 +573,7 @@ int main(int argc, char **argv, char **env)
     if (!msg)
       msg = mutt_new_header();
     if (!msg->env)
-      msg->env = mutt_new_envelope();
+      msg->env = mutt_env_new();
 
     for (i = optind; i < argc; i++)
     {
@@ -734,7 +734,7 @@ int main(int argc, char **argv, char **env)
         if (opts_env->subject)
           mutt_str_replace(&msg->env->subject, opts_env->subject);
 
-        mutt_free_envelope(&opts_env);
+        mutt_env_free(&opts_env);
         mutt_free_header(&context_hdr);
       }
       /* Editing the includeFile: pass it directly in.
index 0e20bcc817bd579cec35e4257f897ddafaae52c0..6cbf82eabf0a3d7415f8dc9973a53c4c1b34a107 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -257,7 +257,7 @@ char *mutt_expand_path_regex(char *s, size_t slen, int regex)
         if ((alias = mutt_lookup_alias(s + 1)))
         {
           h = mutt_new_header();
-          h->env = mutt_new_envelope();
+          h->env = mutt_env_new();
           h->env->from = h->env->to = alias;
           mutt_default_save(p, sizeof(p), h);
           h->env->from = h->env->to = NULL;
diff --git a/nntp.c b/nntp.c
index d8e67da9cfc0da305b00b63c90508082ccb3d499..6bff6fa3ec18dfdf258906f6792d19d3948f12e3 100644 (file)
--- a/nntp.c
+++ b/nntp.c
@@ -1697,7 +1697,7 @@ static int nntp_open_message(struct Context *ctx, struct Message *msg, int msgno
   if (ctx->subj_hash && hdr->env->real_subj)
     mutt_hash_delete(ctx->subj_hash, hdr->env->real_subj, hdr, NULL);
 
-  mutt_free_envelope(&hdr->env);
+  mutt_env_free(&hdr->env);
   hdr->env = mutt_read_rfc822_header(msg->fp, hdr, 0, 0);
 
   if (ctx->id_hash && hdr->env->message_id)
diff --git a/parse.c b/parse.c
index c0d686dd309b83816ea1b8a5ecfb04cdc79e06e4..f77195ba23a039d6eb532a95c32419f0872e8ec3 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1149,12 +1149,12 @@ int mutt_parse_rfc822_line(struct Envelope *e, struct Header *hdr, char *line,
  *                  Used for recall-message
  * @retval ptr Newly allocated envelope structure
  *
- * Caller should free the Envelope using mutt_free_envelope().
+ * Caller should free the Envelope using mutt_env_free().
  */
 struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr,
                                          short user_hdrs, short weed)
 {
-  struct Envelope *e = mutt_new_envelope();
+  struct Envelope *e = mutt_env_new();
   char *line = mutt_mem_malloc(LONG_STRING);
   char *p = NULL;
   LOFF_T loc;
diff --git a/pop.c b/pop.c
index 1d7ba8453c08acb0bf1045ca726242c4ab962815..aa439023185dab83dd5a34d679c5b5a3585e21ca 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -666,7 +666,7 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno
   if (ctx->subj_hash && h->env->real_subj)
     mutt_hash_delete(ctx->subj_hash, h->env->real_subj, h, NULL);
   mutt_label_hash_remove(ctx, h);
-  mutt_free_envelope(&h->env);
+  mutt_env_free(&h->env);
   h->env = mutt_read_rfc822_header(msg->fp, h, 0, 0);
   if (ctx->subj_hash && h->env->real_subj)
     mutt_hash_insert(ctx->subj_hash, h->env->real_subj, h);
index 685705df82484dc49a48a8a565d7270420b690ee..c0f0432a72b11c54d711af1e0d31ec5fb0d2a120 100644 (file)
@@ -587,7 +587,7 @@ int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr,
     {
     err:
       mx_close_message(ctx, &msg);
-      mutt_free_envelope(&newhdr->env);
+      mutt_env_free(&newhdr->env);
       mutt_free_body(&newhdr->content);
       mutt_error(_("Decryption failed."));
       return -1;
@@ -741,7 +741,7 @@ bail:
 
   if (rc == -1)
   {
-    mutt_free_envelope(&newhdr->env);
+    mutt_env_free(&newhdr->env);
     mutt_free_body(&newhdr->content);
   }
 
diff --git a/query.c b/query.c
index 7711f896a97c3bb73c9ab5d0b5915b1771120920..f43f50554d5b7fda84bf497d017f6b4a473b02f0 100644 (file)
--- a/query.c
+++ b/query.c
@@ -463,7 +463,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, int retb
         /* fallthrough */
         case OP_MAIL:
           msg = mutt_new_header();
-          msg->env = mutt_new_envelope();
+          msg->env = mutt_env_new();
           if (!menu->tagprefix)
           {
             msg->env->to = result_to_addr(QueryTable[menu->current].data);
index 8aa5cf1daf79bb656d67fd7f66864d41b7331c18..ac2aa3259a86851346807206778b3234c4d7f74c 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -414,7 +414,7 @@ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx
   }
 
   tmphdr = mutt_new_header();
-  tmphdr->env = mutt_new_envelope();
+  tmphdr->env = mutt_env_new();
   mutt_make_forward_subject(tmphdr->env, Context, parent_hdr);
 
   mutt_mktemp(tmpbody, sizeof(tmpbody));
@@ -584,7 +584,7 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *c
   }
 
   tmphdr = mutt_new_header();
-  tmphdr->env = mutt_new_envelope();
+  tmphdr->env = mutt_env_new();
   mutt_make_forward_subject(tmphdr->env, Context, curhdr);
 
   tmpbody[0] = '\0';
@@ -854,7 +854,7 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx,
     mime_reply_any = true;
 
   tmphdr = mutt_new_header();
-  tmphdr->env = mutt_new_envelope();
+  tmphdr->env = mutt_env_new();
 
   if (attach_reply_envelope_defaults(
           tmphdr->env, actx, parent_hdr ? parent_hdr : (cur ? cur->hdr : NULL), flags) == -1)
diff --git a/send.c b/send.c
index ff81269bee0d4b0e9f618729452ae103c29cb84c..22a17d40a4ea3fd82cc97f0f2da96dffb5d7d826 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1213,7 +1213,7 @@ int mutt_compose_to_sender(struct Header *hdr)
 {
   struct Header *msg = mutt_new_header();
 
-  msg->env = mutt_new_envelope();
+  msg->env = mutt_env_new();
   if (!hdr)
   {
     for (int i = 0; i < Context->msgcount; i++)
@@ -1423,7 +1423,7 @@ int ci_send_message(int flags, struct Header *msg, char *tempfile,
     }
 
     if (!msg->env)
-      msg->env = mutt_new_envelope();
+      msg->env = mutt_env_new();
   }
 
   /* Parse and use an eventual list-post header */