use my usual API's for allocation/deallocation right now.
authorPierre Habouzit <madcoder@debian.org>
Thu, 2 Nov 2006 21:00:43 +0000 (22:00 +0100)
committerPierre Habouzit <madcoder@debian.org>
Thu, 2 Nov 2006 21:00:43 +0000 (22:00 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
19 files changed:
alias.c
commands.c
compose.c
copy.c
crypt-gpgme.c
edit.c
init.c
lib-mime/mime.h
lib-mime/rfc822.c
muttlib.c
nntp/nntp.c
parse.c
pgp.c
pgpkey.c
query.c
recvcmd.c
send.c
sendlib.c
smime.c

diff --git a/alias.c b/alias.c
index aec85d6..c148c53 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -91,7 +91,7 @@ static address_t *mutt_expand_aliases_r (address_t * a, LIST ** expn)
         t = a;
         a = a->next;
         t->next = NULL;
         t = a;
         a = a->next;
         t->next = NULL;
-        rfc822_free_address (&t);
+        address_delete (&t);
         continue;
       }
       else {
         continue;
       }
       else {
index 00a8446..5ceb9ce 100644 (file)
@@ -274,7 +274,7 @@ void ci_bounce_message (HEADER * h, int *redraw)
   if (mutt_addrlist_to_idna (adr, &err) < 0) {
     mutt_error (_("Bad IDN: '%s'"), err);
     p_delete(&err);
   if (mutt_addrlist_to_idna (adr, &err) < 0) {
     mutt_error (_("Bad IDN: '%s'"), err);
     p_delete(&err);
-    rfc822_free_address (&adr);
+    address_delete (&adr);
     return;
   }
 
     return;
   }
 
@@ -295,7 +295,7 @@ void ci_bounce_message (HEADER * h, int *redraw)
   }
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
   }
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
-    rfc822_free_address (&adr);
+    address_delete (&adr);
     CLEARLINE (LINES - 1);
     mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
     return;
     CLEARLINE (LINES - 1);
     mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
     return;
@@ -304,7 +304,7 @@ void ci_bounce_message (HEADER * h, int *redraw)
   CLEARLINE (LINES - 1);
 
   rc = mutt_bounce_message (NULL, h, adr);
   CLEARLINE (LINES - 1);
 
   rc = mutt_bounce_message (NULL, h, adr);
-  rfc822_free_address (&adr);
+  address_delete (&adr);
   /* If no error, or background, display message. */
   if ((rc == 0) || (rc == S_BKG))
     mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
   /* If no error, or background, display message. */
   if ((rc == 0) || (rc == S_BKG))
     mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
index 5b3687a..3d5f39c 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -328,7 +328,7 @@ static int edit_address_list (int line, address_t ** addr)
   mutt_addrlist_to_local (*addr);
   rfc822_write_address (buf, sizeof (buf), *addr, 0);
   if (mutt_get_field (Prompts[line - 1], buf, sizeof (buf), M_ALIAS) == 0) {
   mutt_addrlist_to_local (*addr);
   rfc822_write_address (buf, sizeof (buf), *addr, 0);
   if (mutt_get_field (Prompts[line - 1], buf, sizeof (buf), M_ALIAS) == 0) {
-    rfc822_free_address (addr);
+    address_delete (addr);
     *addr = mutt_parse_adrlist (*addr, buf);
     *addr = mutt_expand_aliases (*addr);
   }
     *addr = mutt_parse_adrlist (*addr, buf);
     *addr = mutt_expand_aliases (*addr);
   }
diff --git a/copy.c b/copy.c
index 565fcb0..66d30b8 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -940,7 +940,7 @@ static int address_header_decode (char **h)
 
   format_address_header (h, a);
 
 
   format_address_header (h, a);
 
-  rfc822_free_address (&a);
+  address_delete (&a);
 
   p_delete(&s);
   return 1;
 
   p_delete(&s);
   return 1;
index bca29d0..b44a9ba 100644 (file)
@@ -3497,7 +3497,7 @@ static crypt_key_t *crypt_getkeybyaddr (address_t * a, short abilities,
                    || !(validity & CRYPT_KV_ADDR)))
         this_key_has_weak = 1;
     }
                    || !(validity & CRYPT_KV_ADDR)))
         this_key_has_weak = 1;
     }
-    rfc822_free_address (&r);
+    address_delete (&r);
 
     if (match) {
       crypt_key_t *tmp;
 
     if (match) {
       crypt_key_t *tmp;
@@ -3730,8 +3730,8 @@ static char *find_keys (address_t * to, address_t * cc, address_t * bcc,
       }
       else if (r == -1) {
         p_delete(&keylist);
       }
       else if (r == -1) {
         p_delete(&keylist);
-        rfc822_free_address (&tmp);
-        rfc822_free_address (&addr);
+        address_delete (&tmp);
+        address_delete (&addr);
         return NULL;
       }
     }
         return NULL;
       }
     }
@@ -3749,8 +3749,8 @@ static char *find_keys (address_t * to, address_t * cc, address_t * bcc,
 #endif
                                     &forced_valid)) == NULL) {
         p_delete(&keylist);
 #endif
                                     &forced_valid)) == NULL) {
         p_delete(&keylist);
-        rfc822_free_address (&tmp);
-        rfc822_free_address (&addr);
+        address_delete (&tmp);
+        address_delete (&addr);
         return NULL;
       }
     }
         return NULL;
       }
     }
@@ -3775,9 +3775,9 @@ static char *find_keys (address_t * to, address_t * cc, address_t * bcc,
     keylist_used = m_strlen(keylist);
 
     crypt_free_key (&key);
     keylist_used = m_strlen(keylist);
 
     crypt_free_key (&key);
-    rfc822_free_address (&addr);
+    address_delete (&addr);
   }
   }
-  rfc822_free_address (&tmp);
+  address_delete (&tmp);
   return (keylist);
 }
 
   return (keylist);
 }
 
diff --git a/edit.c b/edit.c
index d4bcc68..f6cfcf6 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -230,7 +230,7 @@ static void be_edit_header (ENVELOPE * e, int force)
   rfc822_write_address (tmp, sizeof (tmp), e->to, 0);
   if (!e->to || force) {
     if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 4, 0) == 0) {
   rfc822_write_address (tmp, sizeof (tmp), e->to, 0);
   if (!e->to || force) {
     if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 4, 0) == 0) {
-      rfc822_free_address (&e->to);
+      address_delete (&e->to);
       e->to = mutt_parse_adrlist (e->to, tmp);
       e->to = mutt_expand_aliases (e->to);
       mutt_addrlist_to_idna (e->to, NULL);      /* XXX - IDNA error reporting? */
       e->to = mutt_parse_adrlist (e->to, tmp);
       e->to = mutt_expand_aliases (e->to);
       mutt_addrlist_to_idna (e->to, NULL);      /* XXX - IDNA error reporting? */
@@ -259,7 +259,7 @@ static void be_edit_header (ENVELOPE * e, int force)
     mutt_addrlist_to_local (e->cc);
     rfc822_write_address (tmp, sizeof (tmp), e->cc, 0);
     if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 4, 0) == 0) {
     mutt_addrlist_to_local (e->cc);
     rfc822_write_address (tmp, sizeof (tmp), e->cc, 0);
     if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 4, 0) == 0) {
-      rfc822_free_address (&e->cc);
+      address_delete (&e->cc);
       e->cc = mutt_parse_adrlist (e->cc, tmp);
       e->cc = mutt_expand_aliases (e->cc);
       tmp[0] = 0;
       e->cc = mutt_parse_adrlist (e->cc, tmp);
       e->cc = mutt_expand_aliases (e->cc);
       tmp[0] = 0;
@@ -278,7 +278,7 @@ static void be_edit_header (ENVELOPE * e, int force)
     mutt_addrlist_to_local (e->bcc);
     rfc822_write_address (tmp, sizeof (tmp), e->bcc, 0);
     if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 5, 0) == 0) {
     mutt_addrlist_to_local (e->bcc);
     rfc822_write_address (tmp, sizeof (tmp), e->bcc, 0);
     if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 5, 0) == 0) {
-      rfc822_free_address (&e->bcc);
+      address_delete (&e->bcc);
       e->bcc = mutt_parse_adrlist (e->bcc, tmp);
       e->bcc = mutt_expand_aliases (e->bcc);
       mutt_addrlist_to_idna (e->bcc, NULL);
       e->bcc = mutt_parse_adrlist (e->bcc, tmp);
       e->bcc = mutt_expand_aliases (e->bcc);
       mutt_addrlist_to_idna (e->bcc, NULL);
diff --git a/init.c b/init.c
index 94e1707..f52b183 100644 (file)
--- a/init.c
+++ b/init.c
@@ -525,7 +525,7 @@ static int addr_from_string (struct option_t* dst, const char* val,
                              char* errbuf, size_t errlen) {
   if (!dst)
     return (0);
                              char* errbuf, size_t errlen) {
   if (!dst)
     return (0);
-  rfc822_free_address ((address_t**) dst->data);
+  address_delete ((address_t**) dst->data);
   if (val && *val)
     *((address_t**) dst->data) = rfc822_parse_adrlist (NULL, val);
   return (1);
   if (val && *val)
     *((address_t**) dst->data) = rfc822_parse_adrlist (NULL, val);
   return (1);
@@ -1440,7 +1440,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s, unsigned long data,
   }
   else {
     /* override the previous value */
   }
   else {
     /* override the previous value */
-    rfc822_free_address (&tmp->addr);
+    address_delete (&tmp->addr);
     if (CurrentMenu == MENU_ALIAS)
       set_option (OPTFORCEREDRAWINDEX);
   }
     if (CurrentMenu == MENU_ALIAS)
       set_option (OPTFORCEREDRAWINDEX);
   }
@@ -1972,7 +1972,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
             r = -1;
             break;
           } else if (DTYPE (option->type) == DT_ADDR)
             r = -1;
             break;
           } else if (DTYPE (option->type) == DT_ADDR)
-            rfc822_free_address ((address_t **) option->data);
+            address_delete ((address_t **) option->data);
           else if (DTYPE (option->type) == DT_USER)
             /* to unset $user_ means remove */
             hash_delete (ConfigOptions, option->option,
           else if (DTYPE (option->type) == DT_USER)
             /* to unset $user_ means remove */
             hash_delete (ConfigOptions, option->option,
index f2e7b6a..34e1b0f 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
+#include <lib-lib/mem.h>
+
 /* Content-Type */
 enum {
     TYPEOTHER,
 /* Content-Type */
 enum {
     TYPEOTHER,
@@ -104,7 +106,12 @@ typedef struct address_t {
     struct address_t *next;
 } address_t;
 
     struct address_t *next;
 } address_t;
 
-void rfc822_free_address(address_t **);
+DO_INIT(address_t, address);
+void address_wipe(address_t *);
+
+DO_NEW(address_t, address);
+DO_DELETE(address_t, address);
+
 void rfc822_qualify(address_t *, const char *);
 address_t *rfc822_parse_adrlist(address_t *, const char *s);
 address_t *rfc822_cpy_adr(address_t * addr);
 void rfc822_qualify(address_t *, const char *);
 address_t *rfc822_parse_adrlist(address_t *, const char *s);
 address_t *rfc822_cpy_adr(address_t * addr);
@@ -119,7 +126,6 @@ extern const char *RFC822Errors[];
 extern const char RFC822Specials[];
 
 #define rfc822_error(x) RFC822Errors[x]
 extern const char RFC822Specials[];
 
 #define rfc822_error(x) RFC822Errors[x]
-#define rfc822_new_address() calloc(1,sizeof(address_t))
 
 /****************************************************************************/
 /* RFC 2231                                                                 */
 
 /****************************************************************************/
 /* RFC 2231                                                                 */
index 0337478..674d681 100644 (file)
 
 #include "mutt_idna.h"
 
 
 #include "mutt_idna.h"
 
+void address_wipe(address_t *addr)
+{
+    address_delete(&addr->next);
+    p_delete(&addr->personal);
+    p_delete(&addr->mailbox);
+}
+
 
 #define terminate_string(a, b, c) do { if ((b) < (c)) a[(b)] = 0; else \
        a[(c)] = 0; } while (0)
 
 #define terminate_string(a, b, c) do { if ((b) < (c)) a[(b)] = 0; else \
        a[(c)] = 0; } while (0)
@@ -79,19 +86,6 @@ void rfc822_dequote_comment (char *s)
   *w = 0;
 }
 
   *w = 0;
 }
 
-void rfc822_free_address (address_t ** p)
-{
-  address_t *t;
-
-  while (*p) {
-    t = *p;
-    *p = (*p)->next;
-    p_delete(&t->personal);
-    p_delete(&t->mailbox);
-    p_delete(&t);
-  }
-}
-
 static const char *parse_comment (const char *s,
                                   char *comment, size_t * commentlen,
                                   size_t commentmax)
 static const char *parse_comment (const char *s,
                                   char *comment, size_t * commentlen,
                                   size_t commentmax)
@@ -297,10 +291,10 @@ static void
 add_addrspec (address_t ** top, address_t ** last, const char *phrase,
               char *comment, size_t * commentlen, size_t commentmax)
 {
 add_addrspec (address_t ** top, address_t ** last, const char *phrase,
               char *comment, size_t * commentlen, size_t commentmax)
 {
-  address_t *cur = rfc822_new_address ();
+  address_t *cur = address_new ();
 
   if (parse_addr_spec (phrase, comment, commentlen, commentmax, cur) == NULL) {
 
   if (parse_addr_spec (phrase, comment, commentlen, commentmax, cur) == NULL) {
-    rfc822_free_address (&cur);
+    address_delete (&cur);
     return;
   }
 
     return;
   }
 
@@ -351,13 +345,13 @@ address_t *rfc822_parse_adrlist (address_t * top, const char *s)
       if ((ps =
            next_token (s, comment, &commentlen,
                        sizeof (comment) - 1)) == NULL) {
       if ((ps =
            next_token (s, comment, &commentlen,
                        sizeof (comment) - 1)) == NULL) {
-        rfc822_free_address (&top);
+        address_delete (&top);
         return NULL;
       }
       s = ps;
     }
     else if (*s == ':') {
         return NULL;
       }
       s = ps;
     }
     else if (*s == ':') {
-      cur = rfc822_new_address ();
+      cur = address_new ();
       terminate_buffer (phrase, phraselen);
       cur->mailbox = m_strdup(phrase);
       cur->group = 1;
       terminate_buffer (phrase, phraselen);
       cur->mailbox = m_strdup(phrase);
       cur->group = 1;
@@ -385,7 +379,7 @@ address_t *rfc822_parse_adrlist (address_t * top, const char *s)
       }
 
       /* add group terminator */
       }
 
       /* add group terminator */
-      cur = rfc822_new_address ();
+      cur = address_new ();
       if (last) {
         last->next = cur;
         last = cur;
       if (last) {
         last->next = cur;
         last = cur;
@@ -398,7 +392,7 @@ address_t *rfc822_parse_adrlist (address_t * top, const char *s)
     }
     else if (*s == '<') {
       terminate_buffer (phrase, phraselen);
     }
     else if (*s == '<') {
       terminate_buffer (phrase, phraselen);
-      cur = rfc822_new_address ();
+      cur = address_new ();
       if (phraselen) {
         if (cur->personal)
           p_delete(&cur->personal);
       if (phraselen) {
         if (cur->personal)
           p_delete(&cur->personal);
@@ -409,8 +403,8 @@ address_t *rfc822_parse_adrlist (address_t * top, const char *s)
       if ((ps =
            parse_route_addr (s + 1, comment, &commentlen,
                              sizeof (comment) - 1, cur)) == NULL) {
       if ((ps =
            parse_route_addr (s + 1, comment, &commentlen,
                              sizeof (comment) - 1, cur)) == NULL) {
-        rfc822_free_address (&top);
-        rfc822_free_address (&cur);
+        address_delete (&top);
+        address_delete (&cur);
         return NULL;
       }
 
         return NULL;
       }
 
@@ -429,7 +423,7 @@ address_t *rfc822_parse_adrlist (address_t * top, const char *s)
         phrase[phraselen++] = ' ';
       if ((ps =
            next_token (s, phrase, &phraselen, sizeof (phrase) - 1)) == NULL) {
         phrase[phraselen++] = ' ';
       if ((ps =
            next_token (s, phrase, &phraselen, sizeof (phrase) - 1)) == NULL) {
-        rfc822_free_address (&top);
+        address_delete (&top);
         return NULL;
       }
       s = ps;
         return NULL;
       }
       s = ps;
@@ -650,7 +644,7 @@ done:
 /* this should be rfc822_cpy_adr */
 address_t *rfc822_cpy_adr_real (address_t * addr)
 {
 /* this should be rfc822_cpy_adr */
 address_t *rfc822_cpy_adr_real (address_t * addr)
 {
-  address_t *p = rfc822_new_address ();
+  address_t *p = address_new ();
 
   p->personal = m_strdup(addr->personal);
   p->mailbox = m_strdup(addr->mailbox);
 
   p->personal = m_strdup(addr->personal);
   p->mailbox = m_strdup(addr->mailbox);
index 442a8fc..2b0c41f 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -584,14 +584,14 @@ void mutt_free_envelope (ENVELOPE ** p)
 {
   if (!*p)
     return;
 {
   if (!*p)
     return;
-  rfc822_free_address (&(*p)->return_path);
-  rfc822_free_address (&(*p)->from);
-  rfc822_free_address (&(*p)->to);
-  rfc822_free_address (&(*p)->cc);
-  rfc822_free_address (&(*p)->bcc);
-  rfc822_free_address (&(*p)->sender);
-  rfc822_free_address (&(*p)->reply_to);
-  rfc822_free_address (&(*p)->mail_followup_to);
+  address_delete (&(*p)->return_path);
+  address_delete (&(*p)->from);
+  address_delete (&(*p)->to);
+  address_delete (&(*p)->cc);
+  address_delete (&(*p)->bcc);
+  address_delete (&(*p)->sender);
+  address_delete (&(*p)->reply_to);
+  address_delete (&(*p)->mail_followup_to);
 
   p_delete(&(*p)->list_post);
   p_delete(&(*p)->subject);
 
   p_delete(&(*p)->list_post);
   p_delete(&(*p)->subject);
@@ -677,7 +677,7 @@ void mutt_free_alias (ALIAS ** p)
     t = *p;
     *p = (*p)->next;
     p_delete(&t->name);
     t = *p;
     *p = (*p)->next;
     p_delete(&t->name);
-    rfc822_free_address (&t->addr);
+    address_delete (&t->addr);
     p_delete(&t);
   }
 }
     p_delete(&t);
   }
 }
index d5b7991..ae2bec1 100644 (file)
@@ -584,7 +584,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr)
       hdr->env->subject = m_strdup(b);
       break;
     case 2:
       hdr->env->subject = m_strdup(b);
       break;
     case 2:
-      rfc822_free_address (&hdr->env->from);
+      address_delete (&hdr->env->from);
       hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
       /* same as for mutt_parse_rfc822_line():
        * don't leave from info NULL if there's an invalid address (or
       hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
       /* same as for mutt_parse_rfc822_line():
        * don't leave from info NULL if there's an invalid address (or
@@ -592,7 +592,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr)
        * and mark mail/(esp.) news article as your own. aaargh! this
        * bothered me for _years_ */
       if (!hdr->env->from) {
        * and mark mail/(esp.) news article as your own. aaargh! this
        * bothered me for _years_ */
       if (!hdr->env->from) {
-        hdr->env->from = rfc822_new_address ();
+        hdr->env->from = address_new ();
         hdr->env->from->personal = m_strdup(b);
       }
       break;
         hdr->env->from->personal = m_strdup(b);
       }
       break;
diff --git a/parse.c b/parse.c
index d83f12b..fd8e92b 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1027,7 +1027,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
        * and mark mail/(esp.) news article as your own. aaargh! this
        * bothered me for _years_ */
       if (!e->from) {
        * and mark mail/(esp.) news article as your own. aaargh! this
        * bothered me for _years_ */
       if (!e->from) {
-        e->from = rfc822_new_address ();
+        e->from = address_new ();
         e->from->personal = m_strdup(p);
       }
       matched = 1;
         e->from->personal = m_strdup(p);
       }
       matched = 1;
@@ -1103,7 +1103,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
     else if (!ascii_strncasecmp (line + 1, "ail-", 4)) {
       if (!ascii_strcasecmp (line + 5, "reply-to")) {
         /* override the Reply-To: field */
     else if (!ascii_strncasecmp (line + 1, "ail-", 4)) {
       if (!ascii_strcasecmp (line + 5, "reply-to")) {
         /* override the Reply-To: field */
-        rfc822_free_address (&e->reply_to);
+        address_delete (&e->reply_to);
         e->reply_to = rfc822_parse_adrlist (e->reply_to, p);
         matched = 1;
       }
         e->reply_to = rfc822_parse_adrlist (e->reply_to, p);
         matched = 1;
       }
diff --git a/pgp.c b/pgp.c
index e198331..0848077 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -1146,8 +1146,8 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
       }
       else if (r == -1) {
         p_delete(&keylist);
       }
       else if (r == -1) {
         p_delete(&keylist);
-        rfc822_free_address (&tmp);
-        rfc822_free_address (&addr);
+        address_delete (&tmp);
+        address_delete (&addr);
         return NULL;
       }
     }
         return NULL;
       }
     }
@@ -1163,8 +1163,8 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
       if ((key = pgp_ask_for_key (buf, q->mailbox,
                                   KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL) {
         p_delete(&keylist);
       if ((key = pgp_ask_for_key (buf, q->mailbox,
                                   KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL) {
         p_delete(&keylist);
-        rfc822_free_address (&tmp);
-        rfc822_free_address (&addr);
+        address_delete (&tmp);
+        address_delete (&addr);
         return NULL;
       }
     }
         return NULL;
       }
     }
@@ -1181,10 +1181,10 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc)
     keylist_used = m_strlen(keylist);
 
     pgp_free_key (&key);
     keylist_used = m_strlen(keylist);
 
     pgp_free_key (&key);
-    rfc822_free_address (&addr);
+    address_delete (&addr);
 
   }
 
   }
-  rfc822_free_address (&tmp);
+  address_delete (&tmp);
   return (keylist);
 }
 
   return (keylist);
 }
 
index 62d050e..a14ec77 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -861,7 +861,7 @@ pgp_key_t pgp_getkeybyaddr (address_t * a, short abilities, pgp_ring_t keyring)
           this_key_has_weak = 1;
       }
 
           this_key_has_weak = 1;
       }
 
-      rfc822_free_address (&r);
+      address_delete (&r);
     }
 
     if (match && !this_key_has_strong && this_key_has_invalid)
     }
 
     if (match && !this_key_has_strong && this_key_has_invalid)
diff --git a/query.c b/query.c
index 1cf41d2..1aa7b8a 100644 (file)
--- a/query.c
+++ b/query.c
@@ -225,7 +225,7 @@ int mutt_query_complete (char *buf, size_t buflen)
       mutt_addrlist_to_local (tmpa);
       buf[0] = '\0';
       rfc822_write_address (buf, buflen, tmpa, 0);
       mutt_addrlist_to_local (tmpa);
       buf[0] = '\0';
       rfc822_write_address (buf, buflen, tmpa, 0);
-      rfc822_free_address (&tmpa);
+      address_delete (&tmpa);
       mutt_clear_error ();
       return (0);
     }
       mutt_clear_error ();
       return (0);
     }
@@ -310,7 +310,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             if (op == OP_QUERY) {
               queryp = results;
               while (queryp) {
             if (op == OP_QUERY) {
               queryp = results;
               while (queryp) {
-                rfc822_free_address (&queryp->addr);
+                address_delete (&queryp->addr);
                 p_delete(&queryp->name);
                 p_delete(&queryp->other);
                 results = queryp->next;
                 p_delete(&queryp->name);
                 p_delete(&queryp->other);
                 results = queryp->next;
@@ -383,7 +383,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
               address_t *a = result_to_addr (QueryTable[i].data);
 
               rfc822_append (&naddr, a);
               address_t *a = result_to_addr (QueryTable[i].data);
 
               rfc822_append (&naddr, a);
-              rfc822_free_address (&a);
+              address_delete (&a);
             }
 
           mutt_create_alias (NULL, naddr);
             }
 
           mutt_create_alias (NULL, naddr);
@@ -392,7 +392,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
           address_t *a = result_to_addr (QueryTable[menu->current].data);
 
           mutt_create_alias (NULL, a);
           address_t *a = result_to_addr (QueryTable[menu->current].data);
 
           mutt_create_alias (NULL, a);
-          rfc822_free_address (&a);
+          address_delete (&a);
         }
         break;
 
         }
         break;
 
@@ -415,7 +415,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
               address_t *a = result_to_addr (QueryTable[i].data);
 
               rfc822_append (&msg->env->to, a);
               address_t *a = result_to_addr (QueryTable[i].data);
 
               rfc822_append (&msg->env->to, a);
-              rfc822_free_address (&a);
+              address_delete (&a);
             }
         }
         ci_send_message (0, msg, NULL, Context, NULL);
             }
         }
         ci_send_message (0, msg, NULL, Context, NULL);
@@ -445,7 +445,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             tagged = 1;
             rfc822_write_address (buf, buflen, tmpa, 0);
             curpos = m_strlen(buf);
             tagged = 1;
             rfc822_write_address (buf, buflen, tmpa, 0);
             curpos = m_strlen(buf);
-            rfc822_free_address (&tmpa);
+            address_delete (&tmpa);
           }
           else if (curpos + 2 < buflen) {
             address_t *tmpa = result_to_addr (QueryTable[i].data);
           }
           else if (curpos + 2 < buflen) {
             address_t *tmpa = result_to_addr (QueryTable[i].data);
@@ -455,7 +455,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             rfc822_write_address ((char *) buf + curpos + 1,
                                   buflen - curpos - 1, tmpa, 0);
             curpos = m_strlen(buf);
             rfc822_write_address ((char *) buf + curpos + 1,
                                   buflen - curpos - 1, tmpa, 0);
             curpos = m_strlen(buf);
-            rfc822_free_address (&tmpa);
+            address_delete (&tmpa);
           }
         }
       }
           }
         }
       }
@@ -465,14 +465,14 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
 
         mutt_addrlist_to_local (tmpa);
         rfc822_write_address (buf, buflen, tmpa, 0);
 
         mutt_addrlist_to_local (tmpa);
         rfc822_write_address (buf, buflen, tmpa, 0);
-        rfc822_free_address (&tmpa);
+        address_delete (&tmpa);
       }
 
     }
 
     queryp = results;
     while (queryp) {
       }
 
     }
 
     queryp = results;
     while (queryp) {
-      rfc822_free_address (&queryp->addr);
+      address_delete (&queryp->addr);
       p_delete(&queryp->name);
       p_delete(&queryp->other);
       results = queryp->next;
       p_delete(&queryp->name);
       p_delete(&queryp->other);
       results = queryp->next;
index 0ecc70b..c051b8a 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -157,7 +157,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr,
   if (mutt_addrlist_to_idna (adr, &err) < 0) {
     mutt_error (_("Bad IDN: '%s'"), err);
     p_delete(&err);
   if (mutt_addrlist_to_idna (adr, &err) < 0) {
     mutt_error (_("Bad IDN: '%s'"), err);
     p_delete(&err);
-    rfc822_free_address (&adr);
+    address_delete (&adr);
     return;
   }
 
     return;
   }
 
@@ -182,7 +182,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr,
   }
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
   }
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
-    rfc822_free_address (&adr);
+    address_delete (&adr);
     CLEARLINE (LINES - 1);
     mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
     return;
     CLEARLINE (LINES - 1);
     mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
     return;
diff --git a/send.c b/send.c
index ef1ef49..f98e32b 100644 (file)
--- a/send.c
+++ b/send.c
@@ -111,13 +111,13 @@ static address_t *mutt_remove_xrefs (address_t * a, address_t * b)
       if (prev) {
         prev->next = b->next;
         b->next = NULL;
       if (prev) {
         prev->next = b->next;
         b->next = NULL;
-        rfc822_free_address (&b);
+        address_delete (&b);
         b = prev;
       }
       else {
         top = top->next;
         b->next = NULL;
         b = prev;
       }
       else {
         top = top->next;
         b->next = NULL;
-        rfc822_free_address (&b);
+        address_delete (&b);
         b = top;
       }
     }
         b = top;
       }
     }
@@ -153,7 +153,7 @@ static address_t *remove_user (address_t * a, int leave_only)
       a = a->next;
       if (!leave_only || a || last) {
         tmp->next = NULL;
       a = a->next;
       if (!leave_only || a || last) {
         tmp->next = NULL;
-        rfc822_free_address (&tmp);
+        address_delete (&tmp);
       }
       else
         last = top = tmp;
       }
       else
         last = top = tmp;
@@ -193,7 +193,7 @@ static int edit_address (address_t ** a, const char *field)
     rfc822_write_address (buf, sizeof (buf), *a, 0);
     if (mutt_get_field (field, buf, sizeof (buf), M_ALIAS) != 0)
       return (-1);
     rfc822_write_address (buf, sizeof (buf), *a, 0);
     if (mutt_get_field (field, buf, sizeof (buf), M_ALIAS) != 0)
       return (-1);
-    rfc822_free_address (a);
+    address_delete (a);
     *a = mutt_expand_aliases (mutt_parse_adrlist (NULL, buf));
     if ((idna_ok = mutt_addrlist_to_idna (*a, &err)) != 0) {
       mutt_error (_("Error: '%s' is a bad IDN."), err);
     *a = mutt_expand_aliases (mutt_parse_adrlist (NULL, buf));
     if ((idna_ok = mutt_addrlist_to_idna (*a, &err)) != 0) {
       mutt_error (_("Error: '%s' is a bad IDN."), err);
@@ -343,11 +343,11 @@ static void process_user_header (ENVELOPE * env)
   for (; uh; uh = uh->next) {
     if (ascii_strncasecmp ("from:", uh->data, 5) == 0) {
       /* User has specified a default From: address.  Remove default address */
   for (; uh; uh = uh->next) {
     if (ascii_strncasecmp ("from:", uh->data, 5) == 0) {
       /* User has specified a default From: address.  Remove default address */
-      rfc822_free_address (&env->from);
+      address_delete (&env->from);
       env->from = rfc822_parse_adrlist (env->from, uh->data + 5);
     }
     else if (ascii_strncasecmp ("reply-to:", uh->data, 9) == 0) {
       env->from = rfc822_parse_adrlist (env->from, uh->data + 5);
     }
     else if (ascii_strncasecmp ("reply-to:", uh->data, 9) == 0) {
-      rfc822_free_address (&env->reply_to);
+      address_delete (&env->reply_to);
       env->reply_to = rfc822_parse_adrlist (env->reply_to, uh->data + 9);
     }
     else if (ascii_strncasecmp ("message-id:", uh->data, 11) == 0)
       env->reply_to = rfc822_parse_adrlist (env->reply_to, uh->data + 9);
     }
     else if (ascii_strncasecmp ("message-id:", uh->data, 11) == 0)
@@ -496,7 +496,7 @@ static int default_to (address_t ** to, ENVELOPE * env, int flags, int hmfupto)
     case M_YES:
       tmp = find_mailing_lists (env->to, env->cc);
       rfc822_append (to, tmp);
     case M_YES:
       tmp = find_mailing_lists (env->to, env->cc);
       rfc822_append (to, tmp);
-      rfc822_free_address (&tmp);
+      address_delete (&tmp);
       return 0;
     case -1:
       return -1;                /* abort */
       return 0;
     case -1:
       return -1;                /* abort */
@@ -572,7 +572,7 @@ int mutt_fetch_recips (ENVELOPE * out, ENVELOPE * in, int flags)
   if (flags & SENDLISTREPLY) {
     tmp = find_mailing_lists (in->to, in->cc);
     rfc822_append (&out->to, tmp);
   if (flags & SENDLISTREPLY) {
     tmp = find_mailing_lists (in->to, in->cc);
     rfc822_append (&out->to, tmp);
-    rfc822_free_address (&tmp);
+    address_delete (&tmp);
 
     if (in->mail_followup_to && hmfupto == M_YES &&
         default_to (&out->cc, in, flags & SENDLISTREPLY, hmfupto) == -1)
 
     if (in->mail_followup_to && hmfupto == M_YES &&
         default_to (&out->cc, in, flags & SENDLISTREPLY, hmfupto) == -1)
@@ -985,12 +985,12 @@ address_t *mutt_default_from (void)
   if (From)
     adr = rfc822_cpy_adr_real (From);
   else if (option (OPTUSEDOMAIN)) {
   if (From)
     adr = rfc822_cpy_adr_real (From);
   else if (option (OPTUSEDOMAIN)) {
-    adr = rfc822_new_address ();
+    adr = address_new ();
     adr->mailbox = p_new(char, m_strlen(Username) + m_strlen(fqdn) + 2);
     sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn));  /* __SPRINTF_CHECKED__ */
   }
   else {
     adr->mailbox = p_new(char, m_strlen(Username) + m_strlen(fqdn) + 2);
     sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn));  /* __SPRINTF_CHECKED__ */
   }
   else {
-    adr = rfc822_new_address ();
+    adr = address_new ();
     adr->mailbox = m_strdup(NONULL (Username));
   }
 
     adr->mailbox = m_strdup(NONULL (Username));
   }
 
@@ -1186,7 +1186,7 @@ int ci_send_message (int flags, /* send mode */
     /* Use any list-post header as a template */
     url_parse_mailto (msg->env, NULL, cur->env->list_post);
     /* We don't let them set the sender's address. */
     /* Use any list-post header as a template */
     url_parse_mailto (msg->env, NULL, cur->env->list_post);
     /* We don't let them set the sender's address. */
-    rfc822_free_address (&msg->env->from);
+    address_delete (&msg->env->from);
   }
 
   if (!(flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) {
   }
 
   if (!(flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) {
@@ -1315,7 +1315,7 @@ int ci_send_message (int flags, /* send mode */
     msg->replied = 0;
 
     if (killfrom) {
     msg->replied = 0;
 
     if (killfrom) {
-      rfc822_free_address (&msg->env->from);
+      address_delete (&msg->env->from);
       killfrom = 0;
     }
 
       killfrom = 0;
     }
 
@@ -1502,7 +1502,7 @@ int ci_send_message (int flags, /* send mode */
     }
     mutt_select_fcc (fcc, sizeof (fcc), msg);
     if (killfrom) {
     }
     mutt_select_fcc (fcc, sizeof (fcc), msg);
     if (killfrom) {
-      rfc822_free_address (&msg->env->from);
+      address_delete (&msg->env->from);
       killfrom = 0;
     }
   }
       killfrom = 0;
     }
   }
index 33b7e9a..6a25038 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -2148,9 +2148,9 @@ void mutt_prepare_envelope (ENVELOPE * env, int final)
        * recipients if there is no To: or Cc: field, so attempt to suppress
        * it by using an empty To: field.
        */
        * recipients if there is no To: or Cc: field, so attempt to suppress
        * it by using an empty To: field.
        */
-      env->to = rfc822_new_address ();
+      env->to = address_new ();
       env->to->group = 1;
       env->to->group = 1;
-      env->to->next = rfc822_new_address ();
+      env->to->next = address_new ();
 
       buffer[0] = 0;
       rfc822_cat (buffer, sizeof (buffer), "undisclosed-recipients",
 
       buffer[0] = 0;
       rfc822_cat (buffer, sizeof (buffer), "undisclosed-recipients",
@@ -2190,7 +2190,7 @@ void mutt_unprepare_envelope (ENVELOPE * env)
   for (item = env->userhdrs; item; item = item->next)
     rfc2047_decode (&item->data);
 
   for (item = env->userhdrs; item; item = item->next)
     rfc2047_decode (&item->data);
 
-  rfc822_free_address (&env->mail_followup_to);
+  address_delete (&env->mail_followup_to);
 
   /* back conversions */
   rfc2047_decode_adrlist (env->to);
 
   /* back conversions */
   rfc2047_decode_adrlist (env->to);
@@ -2282,7 +2282,7 @@ int mutt_bounce_message (FILE * fp, HEADER * h, address_t * to)
 
   ret = _mutt_bounce_message (fp, h, to, resent_from, from);
 
 
   ret = _mutt_bounce_message (fp, h, to, resent_from, from);
 
-  rfc822_free_address (&from);
+  address_delete (&from);
 
   return ret;
 }
 
   return ret;
 }
@@ -2311,7 +2311,7 @@ address_t *mutt_remove_duplicates (address_t * addr)
       *last = addr->next;
 
       addr->next = NULL;
       *last = addr->next;
 
       addr->next = NULL;
-      rfc822_free_address (&addr);
+      address_delete (&addr);
 
       addr = *last;
     }
 
       addr = *last;
     }
diff --git a/smime.c b/smime.c
index 1bad22a..0c9d435 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -721,7 +721,7 @@ void smime_getkeys (ENVELOPE * env)
     }
   if (!found && (t = mutt_default_from ())) {
     _smime_getkeys (t->mailbox);
     }
   if (!found && (t = mutt_default_from ())) {
     _smime_getkeys (t->mailbox);
-    rfc822_free_address (&t);
+    address_delete (&t);
   }
 }
 
   }
 }
 
@@ -778,8 +778,8 @@ char *smime_findKeys (address_t * to, address_t * cc, address_t * bcc)
     if (!keyID) {
       mutt_message (_("No (valid) certificate found for %s."), q->mailbox);
       p_delete(&keylist);
     if (!keyID) {
       mutt_message (_("No (valid) certificate found for %s."), q->mailbox);
       p_delete(&keylist);
-      rfc822_free_address (&tmp);
-      rfc822_free_address (&addr);
+      address_delete (&tmp);
+      address_delete (&addr);
       return NULL;
     }
 
       return NULL;
     }
 
@@ -788,10 +788,10 @@ char *smime_findKeys (address_t * to, address_t * cc, address_t * bcc)
     sprintf (keylist + keylist_used, "%s\n", keyID);    /* __SPRINTF_CHECKED__ */
     keylist_used = m_strlen(keylist);
 
     sprintf (keylist + keylist_used, "%s\n", keyID);    /* __SPRINTF_CHECKED__ */
     keylist_used = m_strlen(keylist);
 
-    rfc822_free_address (&addr);
+    address_delete (&addr);
 
   }
 
   }
-  rfc822_free_address (&tmp);
+  address_delete (&tmp);
   return (keylist);
 }
 
   return (keylist);
 }