From 108f3c7ab59844591f7540347914ea57be5245e2 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Mon, 13 Nov 2006 01:48:49 +0100 Subject: [PATCH] rationalize list handling in mutt a bit. Signed-off-by: Pierre Habouzit --- alias.c | 28 +++++++--------- alias.h | 6 ++-- attach.c | 6 ++-- browser.c | 10 +++--- commands.c | 8 ++--- complete.c | 2 +- compose.c | 4 +-- copy.c | 10 +++--- globals.h | 24 +++++++------- handler.c | 2 +- hcache.c | 6 ++-- headers.c | 8 ++--- imap/browse.c | 8 ++--- imap/imap.c | 26 +++++++-------- imap/imap_private.h | 4 +-- imap/message.c | 16 ++++----- imap/message.h | 2 +- imap/util.c | 2 +- init.c | 70 ++++++++++++++++++++-------------------- lib-crypt/crypt-gpgme.c | 34 +++++++++---------- lib-crypt/gnupgparse.c | 2 +- lib-crypt/pgp.c | 12 +++---- lib-crypt/pgp.h | 8 ++--- lib-crypt/pgpinvoke.c | 2 +- lib-crypt/pgpkey.c | 12 +++---- lib-crypt/smime.c | 10 +++--- lib-lib/list.c | 40 +++++++---------------- lib-lib/list.h | 53 +++++++++++++++--------------- lib-mime/mime-types.h | 23 +++++++------ lib-mime/mime.c | 40 ++++++++--------------- lib-mime/mime.h | 6 ++-- lib-mime/rfc2231.c | 2 +- lib-mime/rfc822address.c | 10 +++--- lib-mime/rfc822parse.c | 30 ++++++++--------- lib-sys/mutt_ssl.c | 2 +- lib-ui/curs_main.c | 4 +-- main.c | 16 ++++----- mutt.h | 4 +-- muttlib.c | 10 +++--- nntp/newsrc.c | 16 ++++----- nntp/nntp.c | 18 +++++------ nntp/nntp.h | 4 +-- pattern.c | 2 +- pop/pop.c | 2 +- postpone.c | 18 +++++------ protos.h | 10 +++--- query.c | 14 ++++---- recvcmd.c | 6 ++-- remailer.c | 8 ++--- remailer.h | 4 +-- send.c | 48 +++++++++++++-------------- sendlib.c | 18 +++++------ thread.c | 20 ++++++------ 53 files changed, 361 insertions(+), 389 deletions(-) diff --git a/alias.c b/alias.c index 32b6df3..dc5084b 100644 --- a/alias.c +++ b/alias.c @@ -44,12 +44,6 @@ static struct mapping_t AliasHelp[] = { {NULL, OP_NULL} }; -void alias_wipe(alias_t *a) { - p_delete(&a->name); - address_delete(&a->addr); - alias_delete(&a->next); -} - const address_t *alias_lookup(const alias_t *list, const char *s) { while (list) { @@ -214,7 +208,7 @@ void mutt_create_alias(ENVELOPE *cur, address_t *iadr) const char *err = NULL; if (mutt_get_field(_("Address: "), buf, sizeof(buf), 0) || !buf[0]) { - alias_delete(&new); + alias_list_wipe(&new); return; } @@ -236,7 +230,7 @@ void mutt_create_alias(ENVELOPE *cur, address_t *iadr) } if (mutt_get_field(_("Personal name: "), buf, sizeof(buf), 0)) { - alias_delete(&new); + alias_list_wipe(&new); return; } new->addr->personal = m_strdup(buf); @@ -245,7 +239,7 @@ void mutt_create_alias(ENVELOPE *cur, address_t *iadr) rfc822_write_address(buf, sizeof(buf), new->addr, 1); snprintf(prompt, sizeof(prompt), _("[%s = %s] Accept?"), new->name, buf); if (mutt_yesorno(prompt, M_YES) != M_YES) { - alias_delete(&new); + alias_list_wipe(&new); return; } @@ -277,7 +271,7 @@ void mutt_create_alias(ENVELOPE *cur, address_t *iadr) } } -static address_t *mutt_expand_aliases_r(address_t *a, LIST **expn) +static address_t *mutt_expand_aliases_r(address_t *a, string_list_t **expn) { address_t *pop, *head = NULL; address_t **last = &head; @@ -289,21 +283,21 @@ static address_t *mutt_expand_aliases_r(address_t *a, LIST **expn) const address_t *t = alias_lookup(Aliases, pop->mailbox); if (t) { - LIST *u; + string_list_t *u; for (u = *expn; u; u = u->next) { if (!m_strcmp(pop->mailbox, u->data)) { /* alias already found */ - address_delete(&pop); + address_list_wipe(&pop); continue; } } /* save the fact we saw it */ - u = mutt_new_list(); + u = string_item_new(); u->data = m_strdup(pop->mailbox); u->next = *expn; *expn = u; - address_delete(&pop); + address_list_wipe(&pop); /* recurse */ last = address_list_last(last); @@ -336,10 +330,10 @@ static address_t *mutt_expand_aliases_r(address_t *a, LIST **expn) address_t *mutt_expand_aliases(address_t *a) { address_t *t; - LIST *expn = NULL; /* previously expanded aliases to avoid loops */ + string_list_t *expn = NULL; /* previously expanded aliases to avoid loops */ t = mutt_expand_aliases_r(a, &expn); - mutt_free_list(&expn); + string_list_wipe(&expn); return mutt_remove_duplicates(t); } @@ -458,7 +452,7 @@ int mutt_alias_complete (char *s, size_t buflen) Aliases = a_cur->next; a_cur->next = NULL; - alias_delete(&a_cur); + alias_list_wipe(&a_cur); if (a_list) a_cur = a_list; diff --git a/alias.h b/alias.h index 0c9a307..244c0a4 100644 --- a/alias.h +++ b/alias.h @@ -22,11 +22,13 @@ typedef struct alias_t { } alias_t; DO_INIT(alias_t, alias); -void alias_wipe(alias_t *a); +static inline void alias_wipe(alias_t *a) { + address_list_wipe(&a->addr); +} DO_NEW(alias_t, alias); DO_DELETE(alias_t, alias); -DO_SLIST(alias_t, alias); +DO_SLIST(alias_t, alias, alias_delete); const address_t *alias_lookup(const alias_t *list, const char *s); int mutt_addr_is_user(address_t *); diff --git a/attach.c b/attach.c index a36fdf4..e352c4a 100644 --- a/attach.c +++ b/attach.c @@ -144,7 +144,7 @@ int mutt_compose_attachment (BODY * a) b = mutt_read_mime_header (fp, 0); if (b) { if (b->parameter) { - parameter_delete(&a->parameter); + parameter_list_wipe(&a->parameter); a->parameter = b->parameter; b->parameter = NULL; } @@ -315,7 +315,7 @@ static int is_mmnoask (const char *buf) void mutt_check_lookup_list (BODY * b, char *type, int len) { - LIST *t = MimeLookupList; + string_list_t *t = MimeLookupList; int i; for (; t; t = t->next) { @@ -351,7 +351,7 @@ void mutt_check_lookup_list (BODY * b, char *type, int len) int mutt_is_autoview (BODY * b, const char *type) { - LIST *t = AutoViewList; + string_list_t *t = AutoViewList; char _type[SHORT_STRING]; int i; diff --git a/browser.c b/browser.c index 5544e5a..c6ee31b 100644 --- a/browser.c +++ b/browser.c @@ -466,7 +466,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, { #ifdef USE_NNTP if (option (OPTNEWS)) { - LIST *tmp; + string_list_t *tmp; NNTP_DATA *data; NNTP_SERVER *news = CurrentNewsSrv; @@ -567,7 +567,7 @@ static int examine_mailboxes (MUTTMENU * menu, struct browser_state *state) #ifdef USE_NNTP if (option (OPTNEWS)) { - LIST *tmp; + string_list_t *tmp; NNTP_DATA *data; NNTP_SERVER *news = CurrentNewsSrv; @@ -756,7 +756,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, if (*f) m_strcpy(prefix, sizeof(prefix), f); else { - LIST *list; + string_list_t *list; /* default state for news reader mode is browse subscribed newsgroups */ buffy = 0; @@ -1384,7 +1384,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, break; { - LIST *tmp; + string_list_t *tmp; NNTP_DATA *data; for (tmp = CurrentNewsSrv->list; tmp; tmp = tmp->next) { @@ -1478,7 +1478,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, } } if (i == OP_SUBSCRIBE_PATTERN) { - LIST *grouplist = NULL; + string_list_t *grouplist = NULL; if (news) grouplist = news->list; diff --git a/commands.c b/commands.c index 622650a..dc0a6f4 100644 --- a/commands.c +++ b/commands.c @@ -271,7 +271,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); - address_delete (&adr); + address_list_wipe(&adr); return; } @@ -292,7 +292,7 @@ void ci_bounce_message (HEADER * h, int *redraw) } if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) { - address_delete (&adr); + address_list_wipe(&adr); CLEARLINE (LINES - 1); mutt_message (h ? _("Message not bounced.") : _("Messages not bounced.")); return; @@ -301,7 +301,7 @@ void ci_bounce_message (HEADER * h, int *redraw) CLEARLINE (LINES - 1); rc = mutt_bounce_message (NULL, h, adr); - address_delete (&adr); + address_list_wipe(&adr); /* If no error, or background, display message. */ if ((rc == 0) || (rc == S_BKG)) mutt_message (h ? _("Message bounced.") : _("Messages bounced.")); @@ -857,7 +857,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp) return; /* clean up previous junk */ - parameter_delete(&b->parameter); + parameter_list_wipe(&b->parameter); p_delete(&b->subtype); mutt_parse_content_type (buf, b); diff --git a/complete.c b/complete.c index b9d1088..e1815c7 100644 --- a/complete.c +++ b/complete.c @@ -49,7 +49,7 @@ int mutt_complete (char *s, size_t slen) #ifdef USE_NNTP if (option (OPTNEWS)) { - LIST *l = CurrentNewsSrv->list; + string_list_t *l = CurrentNewsSrv->list; m_strcpy(filepart, sizeof(filepart), s); diff --git a/compose.c b/compose.c index a37955e..2e96e7d 100644 --- a/compose.c +++ b/compose.c @@ -198,7 +198,7 @@ static void redraw_crypt_lines (HEADER * msg) #ifdef MIXMASTER -static void redraw_mix_line (LIST * chain) +static void redraw_mix_line (string_list_t * chain) { int c; const char *t; @@ -318,7 +318,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) { - address_delete (addr); + address_list_wipe(addr); *addr = mutt_parse_adrlist (*addr, buf); *addr = mutt_expand_aliases (*addr); } diff --git a/copy.c b/copy.c index 2c653e1..46dfd64 100644 --- a/copy.c +++ b/copy.c @@ -47,7 +47,7 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end, int ignore = 0; char buf[STRING]; /* should be long enough to get most fields in one pass */ char *nl; - LIST *t; + string_list_t *t; char **headers; int hdr_count; int x; @@ -366,7 +366,7 @@ mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags, if (flags & CH_UPDATE) { if ((flags & CH_NOSTATUS) == 0) { if (h->env->irt_changed && h->env->in_reply_to) { - LIST *listp = h->env->in_reply_to; + string_list_t *listp = h->env->in_reply_to; if (fputs ("In-Reply-To: ", out) == EOF) return (-1); @@ -380,7 +380,7 @@ mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags, } if (h->env->refs_changed && h->env->references) { - LIST *listp = h->env->references, *refs = NULL, *t; + string_list_t *listp = h->env->references, *refs = NULL, *t; if (fputs ("References: ", out) == EOF) return (-1); @@ -388,7 +388,7 @@ mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags, /* Mutt stores references in reverse order, thus we create * a reordered refs list that we can put in the headers */ for (; listp; listp = listp->next, refs = t) { - t = p_new(LIST, 1); + t = p_new(string_list_t, 1); t->data = listp->data; t->next = refs; } @@ -935,7 +935,7 @@ static int address_header_decode (char **h) format_address_header (h, a); - address_delete (&a); + address_list_wipe(&a); p_delete(&s); return 1; diff --git a/globals.h b/globals.h index 48a8842..3f3a45c 100644 --- a/globals.h +++ b/globals.h @@ -157,7 +157,7 @@ WHERE char *SslEntropyFile INITVAL (NULL); #endif #ifdef USE_SSL WHERE char *SslClientCert INITVAL (NULL); -WHERE LIST *SslSessionCerts INITVAL (NULL); +WHERE string_list_t *SslSessionCerts INITVAL (NULL); #endif #ifdef USE_GNUTLS WHERE short SslDHPrimeBits; @@ -176,16 +176,16 @@ WHERE char *XtermIcon; WHERE char *CurrentFolder; WHERE char *LastFolder; -WHERE LIST *AutoViewList INITVAL (0); -WHERE LIST *AlternativeOrderList INITVAL (0); -WHERE LIST *AttachAllow INITVAL(0); -WHERE LIST *AttachExclude INITVAL(0); -WHERE LIST *InlineAllow INITVAL(0); -WHERE LIST *InlineExclude INITVAL(0); -WHERE LIST *HeaderOrderList INITVAL (0); -WHERE LIST *Ignore INITVAL (0); -WHERE LIST *MimeLookupList INITVAL (0); -WHERE LIST *UnIgnore INITVAL (0); +WHERE string_list_t *AutoViewList INITVAL (0); +WHERE string_list_t *AlternativeOrderList INITVAL (0); +WHERE string_list_t *AttachAllow INITVAL(0); +WHERE string_list_t *AttachExclude INITVAL(0); +WHERE string_list_t *InlineAllow INITVAL(0); +WHERE string_list_t *InlineExclude INITVAL(0); +WHERE string_list_t *HeaderOrderList INITVAL (0); +WHERE string_list_t *Ignore INITVAL (0); +WHERE string_list_t *MimeLookupList INITVAL (0); +WHERE string_list_t *UnIgnore INITVAL (0); WHERE list2_t *Alternates INITVAL (0); WHERE list2_t *UnAlternates INITVAL (0); @@ -250,7 +250,7 @@ WHERE SIG_ATOMIC_VOLATILE_T SigWinch INITVAL (0); WHERE int CurrentMenu; WHERE alias_t *Aliases INITVAL (0); -WHERE LIST *UserHeader INITVAL (0); +WHERE string_list_t *UserHeader INITVAL (0); /*-- formerly in pgp.h --*/ WHERE rx_t PgpGoodSign; diff --git a/handler.c b/handler.c index 1c5d6fa..9ab5231 100644 --- a/handler.c +++ b/handler.c @@ -772,7 +772,7 @@ static int alternative_handler (BODY * a, STATE * s) { BODY *choice = NULL; BODY *b; - LIST *t; + string_list_t *t; char buf[STRING]; int type = 0; int mustfree = 0; diff --git a/hcache.c b/hcache.c index af044b9..714c204 100644 --- a/hcache.c +++ b/hcache.c @@ -200,7 +200,7 @@ static void restore_address (address_t ** a, const unsigned char *d, int *off) *a = NULL; } -static unsigned char *dump_list (LIST * l, unsigned char *d, int *off) +static unsigned char *dump_list (string_list_t * l, unsigned char *d, int *off) { unsigned int counter = 0; unsigned int start_off = *off; @@ -218,14 +218,14 @@ static unsigned char *dump_list (LIST * l, unsigned char *d, int *off) return d; } -static void restore_list (LIST ** l, const unsigned char *d, int *off) +static void restore_list (string_list_t ** l, const unsigned char *d, int *off) { unsigned int counter; restore_int (&counter, d, off); while (counter) { - *l = p_new(LIST, 1); + *l = p_new(string_list_t, 1); restore_char (&(*l)->data, d, off); l = &(*l)->next; counter--; diff --git a/headers.c b/headers.c index ecb5756..71bc481 100644 --- a/headers.c +++ b/headers.c @@ -36,7 +36,7 @@ void mutt_edit_headers (const char *editor, ENVELOPE *n; time_t mtime; struct stat st; - LIST *cur, **last = NULL, *tmp; + string_list_t *cur, **last = NULL, *tmp; mutt_mktemp (path); if ((ofp = safe_fopen (path, "w")) == NULL) { @@ -76,7 +76,7 @@ void mutt_edit_headers (const char *editor, } mutt_unlink (body); - mutt_free_list (&msg->env->userhdrs); + string_list_wipe(&msg->env->userhdrs); /* Read the temp file back in */ if ((ifp = fopen (path, "r")) == NULL) { @@ -110,7 +110,7 @@ void mutt_edit_headers (const char *editor, #ifdef USE_NNTP if (!option (OPTNEWSSEND)) #endif - mutt_free_list (&msg->env->references); + string_list_wipe(&msg->env->references); mutt_expand_aliases_env (msg->env); @@ -179,7 +179,7 @@ void mutt_edit_headers (const char *editor, *last = cur->next; cur = cur->next; tmp->next = NULL; - mutt_free_list (&tmp); + string_list_wipe(&tmp); } } } diff --git a/imap/browse.c b/imap/browse.c index 65f94f2..e70ffbd 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -75,7 +75,7 @@ int imap_browse (char *path, struct browser_state *state) save_lsub = option (OPTIMAPCHECKSUBSCRIBED); unset_option (OPTIMAPCHECKSUBSCRIBED); m_strcpy(list_cmd, sizeof(list_cmd), - option(OPTIMAPLSUB) ? "LSUB" : "LIST"); + option(OPTIMAPLSUB) ? "LSUB" : "string_list_t"); if (!(idata = imap_conn_find (&(mx.account), 0))) goto fail; @@ -195,7 +195,7 @@ int imap_browse (char *path, struct browser_state *state) * namespace is not "", so we have to list it explicitly. We ask the * server to see if it has descendants. */ debug_print (3, ("adding INBOX\n")); - if (browse_add_list_result (idata, "LIST \"\" \"INBOX\"", state, 0)) + if (browse_add_list_result (idata, "string_list_t \"\" \"INBOX\"", state, 0)) goto fail; } @@ -553,11 +553,11 @@ static int browse_verify_namespace (IMAP_DATA * idata, * than invisible namespaces */ if (nsi->delim) snprintf (buf, sizeof (buf), "%s \"\" \"%s%c%%\"", - option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix, + option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix, nsi->delim); else snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"", - option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix); + option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix); imap_cmd_start (idata, buf); diff --git a/imap/imap.c b/imap/imap.c index ec31f58..dbe6f76 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -44,7 +44,7 @@ /* imap forward declarations */ static int imap_get_delim (IMAP_DATA * idata); -static char *imap_get_flags (LIST ** hflags, char *s); +static char *imap_get_flags (string_list_t ** hflags, char *s); static int imap_check_acl (IMAP_DATA * idata); static int imap_check_capabilities (IMAP_DATA * idata); static void imap_set_flag (IMAP_DATA * idata, int aclbit, int flag, @@ -266,14 +266,14 @@ static int imap_get_delim (IMAP_DATA * idata) * than getting the delim wrong */ idata->delim = '/'; - imap_cmd_start (idata, "LIST \"\" \"\""); + imap_cmd_start (idata, "string_list_t \"\" \"\""); do { if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) break; s = imap_next_word (idata->cmd.buf); - if (ascii_strncasecmp ("LIST", s, 4) == 0) { + if (ascii_strncasecmp ("string_list_t", s, 4) == 0) { s = imap_next_word (s); s = imap_next_word (s); if (s && s[0] == '\"' && s[1] && s[2] == '\"') @@ -482,9 +482,9 @@ bail: /* imap_get_flags: Make a simple list out of a FLAGS response. * return stream following FLAGS response */ -static char *imap_get_flags (LIST ** hflags, char *s) +static char *imap_get_flags (string_list_t ** hflags, char *s) { - LIST *flags; + string_list_t *flags; char *flag_word; char ctmp; @@ -500,7 +500,7 @@ static char *imap_get_flags (LIST ** hflags, char *s) } /* create list, update caller's flags handle */ - flags = mutt_new_list (); + flags = string_item_new(); *hflags = flags; while (*s && *s != ')') { @@ -518,7 +518,7 @@ static char *imap_get_flags (LIST ** hflags, char *s) /* note bad flags response */ if (*s != ')') { debug_print (1, ("Unterminated FLAGS response: %s\n", s)); - mutt_free_list (hflags); + string_list_wipe(hflags); return NULL; } @@ -601,7 +601,7 @@ int imap_open_mailbox (CONTEXT * ctx) else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) { debug_print (2, ("Getting mailbox PERMANENTFLAGS\n")); /* safe to call on NULL */ - mutt_free_list (&(idata->flags)); + string_list_wipe(&(idata->flags)); /* skip "OK [PERMANENT" so syntax is the same as FLAGS */ pc += 13; if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL) @@ -654,7 +654,7 @@ int imap_open_mailbox (CONTEXT * ctx) if (!idata->flags) debug_print (3, ("No folder flags found\n")); else { - LIST *t = idata->flags; + string_list_t *t = idata->flags; debug_print (3, ("Mailbox flags:\n")); @@ -1082,7 +1082,7 @@ void imap_close_mailbox (CONTEXT * ctx) idata->reopen &= IMAP_REOPEN_ALLOW; p_delete(&(idata->mailbox)); - mutt_free_list (&idata->flags); + string_list_wipe(&idata->flags); idata->ctx = NULL; } @@ -1361,7 +1361,7 @@ int imap_search (CONTEXT* ctx, const pattern_t* pat) { /* all this listing/browsing is a mess. I don't like that name is a pointer * into idata->buf (used to be a pointer into the passed in buffer, just * as bad), nor do I like the fact that the fetch is done here. This - * code can't possibly handle non-LIST untagged responses properly. + * code can't possibly handle non-string_list_t untagged responses properly. * FIXME. ?! */ int imap_parse_list_response (IMAP_DATA * idata, char **name, int *noselect, int *noinferiors, char *delim) @@ -1379,7 +1379,7 @@ int imap_parse_list_response (IMAP_DATA * idata, char **name, int *noselect, return -1; s = imap_next_word (idata->cmd.buf); - if ((ascii_strncasecmp ("LIST", s, 4) == 0) || + if ((ascii_strncasecmp ("string_list_t", s, 4) == 0) || (ascii_strncasecmp ("LSUB", s, 4) == 0)) { *noselect = 0; *noinferiors = 0; @@ -1582,7 +1582,7 @@ int imap_complete (char *dest, size_t dlen, char *path) { /* fire off command */ snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"", - option (OPTIMAPLSUB) ? "LSUB" : "LIST", list); + option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", list); imap_cmd_start (idata, buf); diff --git a/imap/imap_private.h b/imap/imap_private.h index eecc798..2e9095c 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -156,7 +156,7 @@ typedef struct { #endif /* all folder flags - system flags AND keywords */ - LIST *flags; + string_list_t *flags; } IMAP_DATA; /* I wish that were called IMAP_CONTEXT :( */ @@ -192,7 +192,7 @@ int imap_code (const char *s); int imap_exec (IMAP_DATA * idata, const char *cmd, int flags); /* message.c */ -void imap_add_keywords (char *s, HEADER * keywords, LIST * mailbox_flags, +void imap_add_keywords (char *s, HEADER * keywords, string_list_t * mailbox_flags, size_t slen); void imap_free_header_data (void **data); int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend); diff --git a/imap/message.c b/imap/message.c index ba49cd1..9e7b39b 100644 --- a/imap/message.c +++ b/imap/message.c @@ -47,7 +47,7 @@ static void flush_buffer (char *buf, size_t * len, CONNECTION * conn); static int msg_fetch_header (CONTEXT * ctx, IMAP_HEADER * h, char *buf, FILE * fp); -static int msg_has_flag (LIST * flag_list, const char *flag); +static int msg_has_flag (string_list_t * flag_list, const char *flag); static int msg_parse_fetch (IMAP_HEADER * h, char *s); static char *msg_parse_flags (IMAP_HEADER * h, char *s); @@ -74,7 +74,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) int rc, mfhrc, oldmsgcount; int fetchlast = 0; const char *want_headers = - "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL"; + "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES string_list_t-POST X-LABEL"; #ifdef USE_HCACHE void *hc = NULL; @@ -758,10 +758,10 @@ fail: /* imap_add_keywords: concatenate custom IMAP tags to list, if they * appear in the folder flags list. Why wouldn't they? */ -void imap_add_keywords (char *s, HEADER * h, LIST * mailbox_flags, +void imap_add_keywords (char *s, HEADER * h, string_list_t * mailbox_flags, size_t slen) { - LIST *keywords; + string_list_t *keywords; if (!mailbox_flags || !HEADER_DATA (h) || !HEADER_DATA (h)->keywords) return; @@ -781,7 +781,7 @@ void imap_add_keywords (char *s, HEADER * h, LIST * mailbox_flags, void imap_free_header_data (void **data) { /* this should be safe even if the list wasn't used */ - mutt_free_list (&(((IMAP_HEADER_DATA *) * data)->keywords)); + string_list_wipe(&(((IMAP_HEADER_DATA *) * data)->keywords)); p_delete(data); } @@ -823,7 +823,7 @@ char *imap_set_flags (IMAP_DATA * idata, HEADER * h, char *s) ctx->changed &= ~readonly; ctx->readonly = readonly; - mutt_free_list (&(HEADER_DATA (h)->keywords)); + string_list_wipe(&(HEADER_DATA (h)->keywords)); HEADER_DATA (h)->keywords = newh.data->keywords; p_delete(&newh.data); @@ -943,7 +943,7 @@ static int msg_fetch_header_fetch (CONTEXT * ctx, IMAP_HEADER * h, char *buf, /* msg_has_flag: do a caseless comparison of the flag against a flag list, * return 1 if found or flag list has '\*', 0 otherwise */ -static int msg_has_flag (LIST * flag_list, const char *flag) +static int msg_has_flag (string_list_t * flag_list, const char *flag) { if (!flag_list) return 0; @@ -1067,7 +1067,7 @@ static char *msg_parse_flags (IMAP_HEADER * h, char *s) char *flag_word = s; if (!h->data->keywords) - h->data->keywords = mutt_new_list (); + h->data->keywords = string_item_new(); while (*s && !ISSPACE (*s) && *s != ')') s++; diff --git a/imap/message.h b/imap/message.h index 0d53591..4072e37 100644 --- a/imap/message.h +++ b/imap/message.h @@ -17,7 +17,7 @@ /* IMAP-specific header data, stored as HEADER->data */ typedef struct imap_header_data { unsigned int uid; /* 32-bit Message UID */ - LIST *keywords; + string_list_t *keywords; } IMAP_HEADER_DATA; typedef struct { diff --git a/imap/util.c b/imap/util.c index c14c72b..9a1a9a3 100644 --- a/imap/util.c +++ b/imap/util.c @@ -200,7 +200,7 @@ void imap_free_idata (IMAP_DATA ** idata) return; p_delete(&(*idata)->capstr); - mutt_free_list (&(*idata)->flags); + string_list_wipe(&(*idata)->flags); p_delete(&((*idata)->cmd.buf)); p_delete(idata); } diff --git a/init.c b/init.c index f137e35..e215b0c 100644 --- a/init.c +++ b/init.c @@ -529,7 +529,7 @@ static int addr_from_string (struct option_t* dst, const char* val, char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) { if (!dst) return (0); - address_delete ((address_t**) dst->data); + address_list_wipe((address_t**) dst->data); if (val && *val) *((address_t**) dst->data) = rfc822_parse_adrlist (NULL, val); return (1); @@ -626,9 +626,9 @@ int query_quadoption (int opt, const char *prompt) /* not reached */ } -static void add_to_list (LIST ** list, const char *str) +static void add_to_list (string_list_t ** list, const char *str) { - LIST *t, *last = NULL; + string_list_t *t, *last = NULL; /* don't add a NULL or empty string to the list */ if (!str || *str == '\0') @@ -646,7 +646,7 @@ static void add_to_list (LIST ** list, const char *str) } if (!*list || last) { - t = p_new(LIST, 1); + t = p_new(string_list_t, 1); t->data = m_strdup(str); if (last) { last->next = t; @@ -780,12 +780,12 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat) } -static void remove_from_list (LIST ** l, const char *str) +static void remove_from_list (string_list_t ** l, const char *str) { - LIST *p, *last = NULL; + string_list_t *p, *last = NULL; if (m_strcmp("*", str) == 0) - mutt_free_list (l); /* ``unCMD *'' means delete all current entries */ + string_list_wipe(l); /* ``unCMD *'' means delete all current entries */ else { p = *l; last = NULL; @@ -927,7 +927,7 @@ static int parse_list (BUFFER * buf, BUFFER * s, { do { mutt_extract_token (buf, s, 0); - add_to_list ((LIST **) data, buf->data); + add_to_list ((string_list_t **) data, buf->data); } while (MoreArgs (s)); @@ -1057,10 +1057,10 @@ static int parse_unlist (BUFFER * buf, BUFFER * s, unsigned long data, * Check for deletion of entire list */ if (m_strcmp(buf->data, "*") == 0) { - mutt_free_list ((LIST **) data); + string_list_wipe((string_list_t **) data); break; } - remove_from_list ((LIST **) data, buf->data); + remove_from_list ((string_list_t **) data, buf->data); } while (MoreArgs (s)); @@ -1092,10 +1092,10 @@ static void _attachments_clean (void) { } } -static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, +static int parse_attach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata, BUFFER *err __attribute__ ((unused))) { ATTACH_MATCH *a; - LIST *listp, *lastp; + string_list_t *listp, *lastp; char *p; char *tmpminor; int len; @@ -1149,7 +1149,7 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, debug_print (5, ("parse_attach_list: added %s/%s [%d]\n", a->major, a->minor, a->major_int)); - listp = p_new(LIST, 1); + listp = p_new(string_list_t, 1); listp->data = (char *)a; listp->next = NULL; if (lastp) { @@ -1165,10 +1165,10 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, return 0; } -static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, +static int parse_unattach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata, BUFFER *err __attribute__ ((unused))) { ATTACH_MATCH *a; - LIST *lp, *lastp, *newlp; + string_list_t *lp, *lastp, *newlp; char *tmp; int major; char *minor; @@ -1192,7 +1192,7 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, major = mutt_check_mime_type(tmp); /* We must do our own walk here because remove_from_list() will only - * remove the LIST->data, not anything pointed to by the LIST->data. */ + * remove the string_list_t->data, not anything pointed to by the string_list_t->data. */ lastp = NULL; for(lp = *ldata; lp; ) { a = (ATTACH_MATCH *)lp->data; @@ -1228,7 +1228,7 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, return 0; } -static int print_attach_list (LIST *lp, char op, const char *name) { +static int print_attach_list (string_list_t *lp, char op, const char *name) { while (lp) { printf("attachments %c%s %s/%s\n", op, name, ((ATTACH_MATCH *)lp->data)->major, @@ -1243,7 +1243,7 @@ static int parse_attachments (BUFFER *buf, BUFFER *s, unsigned long data __attribute__ ((unused)), BUFFER *err) { char op, *category; - LIST **listp; + string_list_t **listp; mutt_extract_token(buf, s, 0); if (!buf->data || *buf->data == '\0') { @@ -1293,7 +1293,7 @@ static int parse_attachments (BUFFER *buf, BUFFER *s, static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data __attribute__ ((unused)), BUFFER *err) { char op, *p; - LIST **listp; + string_list_t **listp; mutt_extract_token(buf, s, 0); if (!buf->data || *buf->data == '\0') { @@ -1396,7 +1396,7 @@ static int parse_unalias (BUFFER * buf, BUFFER * s, set_option (OPTFORCEREDRAWINDEX); } else - alias_delete(&Aliases); + alias_list_wipe(&Aliases); break; } else @@ -1413,7 +1413,7 @@ static int parse_unalias (BUFFER * buf, BUFFER * s, else Aliases = tmp->next; tmp->next = NULL; - alias_delete(&tmp); + alias_list_wipe(&tmp); break; } last = tmp; @@ -1457,7 +1457,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s, } else { /* override the previous value */ - address_delete (&tmp->addr); + address_list_wipe(&tmp->addr); if (CurrentMenu == MENU_ALIAS) set_option (OPTFORCEREDRAWINDEX); } @@ -1496,15 +1496,15 @@ parse_unmy_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribute__ ((unused)), BUFFER * err __attribute__ ((unused))) { - LIST *last = NULL; - LIST *tmp = UserHeader; - LIST *ptr; + string_list_t *last = NULL; + string_list_t *tmp = UserHeader; + string_list_t *ptr; size_t l; do { mutt_extract_token (buf, s, 0); if (m_strcmp("*", buf->data) == 0) - mutt_free_list (&UserHeader); + string_list_wipe(&UserHeader); else { tmp = UserHeader; last = NULL; @@ -1523,7 +1523,7 @@ parse_unmy_hdr (BUFFER * buf, BUFFER * s, UserHeader = tmp->next; tmp = tmp->next; ptr->next = NULL; - mutt_free_list (&ptr); + string_list_wipe(&ptr); } else { last = tmp; @@ -1539,7 +1539,7 @@ parse_unmy_hdr (BUFFER * buf, BUFFER * s, static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribute__ ((unused)), BUFFER * err) { - LIST *tmp; + string_list_t *tmp; size_t keylen; char *p; @@ -1563,11 +1563,11 @@ static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribut if (!tmp->next) break; } - tmp->next = mutt_new_list (); + tmp->next = string_item_new(); tmp = tmp->next; } else { - tmp = mutt_new_list (); + tmp = string_item_new(); UserHeader = tmp; } tmp->data = buf->data; @@ -1991,7 +1991,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data, r = -1; break; } else if (DTYPE (option->type) == DT_ADDR) - address_delete ((address_t **) option->data); + address_list_wipe((address_t **) option->data); else if (DTYPE (option->type) == DT_USER) /* to unset $user_ means remove */ hash_delete (ConfigOptions, option->option, @@ -2515,9 +2515,9 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos) } /* Implement the -Q command line flag */ -int mutt_query_variables (LIST * queries) +int mutt_query_variables (string_list_t * queries) { - LIST *p; + string_list_t *p; char errbuff[STRING]; char command[STRING]; @@ -2544,7 +2544,7 @@ int mutt_query_variables (LIST * queries) return 0; } -static int mutt_execute_commands (LIST * p) +static int mutt_execute_commands (string_list_t * p) { BUFFER err, token; char errstr[SHORT_STRING]; @@ -2564,7 +2564,7 @@ static int mutt_execute_commands (LIST * p) return 0; } -void mutt_init (int skip_sys_rc, LIST * commands) +void mutt_init (int skip_sys_rc, string_list_t * commands) { struct passwd *pw; struct utsname utsname; diff --git a/lib-crypt/crypt-gpgme.c b/lib-crypt/crypt-gpgme.c index 8d8fb96..5be0147 100644 --- a/lib-crypt/crypt-gpgme.c +++ b/lib-crypt/crypt-gpgme.c @@ -3018,12 +3018,12 @@ leave: */ -/* Convert LIST into a pattern string suitable to be passed to GPGME. +/* Convert string_list_t into a pattern string suitable to be passed to GPGME. We need to convert spaces in an item into a '+' and '%' into "%25". */ -static char *list_to_pattern (LIST * list) +static char *list_to_pattern (string_list_t * list) { - LIST *l; + string_list_t *l; char *pattern, *p; const char *s; size_t n; @@ -3068,7 +3068,7 @@ static char *list_to_pattern (LIST * list) /* Return a list of keys which are candidates for the selection. Select by looking at the HINTS list. */ -static crypt_key_t *get_candidates (LIST * hints, unsigned int app, +static crypt_key_t *get_candidates (string_list_t * hints, unsigned int app, int secret) { crypt_key_t *db, *k, **kend; @@ -3098,7 +3098,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, depending on the protocol. For gpg we don' t need percent escaped pappert but simple strings passed in an array to the keylist_ext_start function. */ - LIST *l; + string_list_t *l; size_t n; char **patarr; @@ -3212,7 +3212,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, /* Add the string STR to the list HINTS. This list is later used to match addresses. */ -static LIST *crypt_add_string_to_hints (LIST * hints, const char *str) +static string_list_t *crypt_add_string_to_hints (string_list_t * hints, const char *str) { char *scratch; char *t; @@ -3429,7 +3429,7 @@ static crypt_key_t *crypt_getkeybyaddr (address_t * a, short abilities, unsigned int app, int *forced_valid) { address_t *r, *p; - LIST *hints = NULL; + string_list_t *hints = NULL; int weak = 0; int invalid = 0; @@ -3454,7 +3454,7 @@ static crypt_key_t *crypt_getkeybyaddr (address_t * a, short abilities, mutt_message (_("Looking for keys matching \"%s\"..."), a->mailbox); keys = get_candidates (hints, app, (abilities & KEYFLAG_CANSIGN)); - mutt_free_list (&hints); + string_list_wipe(&hints); if (!keys) return NULL; @@ -3498,7 +3498,7 @@ static crypt_key_t *crypt_getkeybyaddr (address_t * a, short abilities, || !(validity & CRYPT_KV_ADDR))) this_key_has_weak = 1; } - address_delete (&r); + address_list_wipe(&r); if (match) { crypt_key_t *tmp; @@ -3546,7 +3546,7 @@ static crypt_key_t *crypt_getkeybyaddr (address_t * a, short abilities, static crypt_key_t *crypt_getkeybystr (char *p, short abilities, unsigned int app, int *forced_valid) { - LIST *hints = NULL; + string_list_t *hints = NULL; crypt_key_t *keys; crypt_key_t *matches = NULL; crypt_key_t **matches_endp = &matches; @@ -3559,7 +3559,7 @@ static crypt_key_t *crypt_getkeybystr (char *p, short abilities, hints = crypt_add_string_to_hints (hints, p); keys = get_candidates (hints, app, (abilities & KEYFLAG_CANSIGN)); - mutt_free_list (&hints); + string_list_wipe(&hints); if (!keys) return NULL; @@ -3731,8 +3731,8 @@ static char *find_keys (address_t * to, address_t * cc, address_t * bcc, } else if (r == -1) { p_delete(&keylist); - address_delete (&tmp); - address_delete (&addr); + address_list_wipe(&tmp); + address_list_wipe(&addr); return NULL; } } @@ -3750,8 +3750,8 @@ static char *find_keys (address_t * to, address_t * cc, address_t * bcc, #endif &forced_valid)) == NULL) { p_delete(&keylist); - address_delete (&tmp); - address_delete (&addr); + address_list_wipe(&tmp); + address_list_wipe(&addr); return NULL; } } @@ -3776,9 +3776,9 @@ static char *find_keys (address_t * to, address_t * cc, address_t * bcc, keylist_used = m_strlen(keylist); crypt_free_key (&key); - address_delete (&addr); + address_list_wipe(&addr); } - address_delete (&tmp); + address_list_wipe(&tmp); return (keylist); } diff --git a/lib-crypt/gnupgparse.c b/lib-crypt/gnupgparse.c index 6b3a7d9..392d735 100644 --- a/lib-crypt/gnupgparse.c +++ b/lib-crypt/gnupgparse.c @@ -299,7 +299,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k) return k; } -pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints) +pgp_key_t pgp_get_candidates (pgp_ring_t keyring, string_list_t * hints) { FILE *fp; pid_t thepid; diff --git a/lib-crypt/pgp.c b/lib-crypt/pgp.c index 0a35e6b..7147bf1 100644 --- a/lib-crypt/pgp.c +++ b/lib-crypt/pgp.c @@ -1144,8 +1144,8 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc) } else if (r == -1) { p_delete(&keylist); - address_delete (&tmp); - address_delete (&addr); + address_list_wipe(&tmp); + address_list_wipe(&addr); return NULL; } } @@ -1161,8 +1161,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); - address_delete (&tmp); - address_delete (&addr); + address_list_wipe(&tmp); + address_list_wipe(&addr); return NULL; } } @@ -1179,10 +1179,10 @@ char *pgp_findKeys (address_t * to, address_t * cc, address_t * bcc) keylist_used = m_strlen(keylist); pgp_free_key (&key); - address_delete (&addr); + address_list_wipe(&addr); } - address_delete (&tmp); + address_list_wipe(&tmp); return (keylist); } diff --git a/lib-crypt/pgp.h b/lib-crypt/pgp.h index 30e17b8..db5f59b 100644 --- a/lib-crypt/pgp.h +++ b/lib-crypt/pgp.h @@ -30,11 +30,11 @@ int mutt_check_pgp (HEADER * h); int pgp_decrypt_mime (FILE *, FILE **, BODY *, BODY **); -/* int pgp_string_matches_hint (const char *s, LIST * hints); */ +/* int pgp_string_matches_hint (const char *s, string_list_t * hints); */ -/* pgp_key_t gpg_get_candidates (struct pgp_vinfo *, pgp_ring_t, LIST *); */ +/* pgp_key_t gpg_get_candidates (struct pgp_vinfo *, pgp_ring_t, string_list_t *); */ pgp_key_t pgp_ask_for_key (char *, char *, short, pgp_ring_t); -pgp_key_t pgp_get_candidates (pgp_ring_t, LIST *); +pgp_key_t pgp_get_candidates (pgp_ring_t, string_list_t *); pgp_key_t pgp_getkeybyaddr (address_t *, short, pgp_ring_t); pgp_key_t pgp_getkeybystr (char *, short, pgp_ring_t); @@ -73,7 +73,7 @@ pid_t pgp_invoke_verify_key (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr, const char *uids); pid_t pgp_invoke_list_keys (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, - pgp_ring_t keyring, LIST * hints); + pgp_ring_t keyring, string_list_t * hints); pid_t pgp_invoke_traditional (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *uids, int flags); diff --git a/lib-crypt/pgpinvoke.c b/lib-crypt/pgpinvoke.c index cdf4e58..38accec 100644 --- a/lib-crypt/pgpinvoke.c +++ b/lib-crypt/pgpinvoke.c @@ -329,7 +329,7 @@ pid_t pgp_invoke_verify_key (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr, pid_t pgp_invoke_list_keys (FILE ** pgpin, FILE ** pgpout, FILE ** pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, - pgp_ring_t keyring, LIST * hints) + pgp_ring_t keyring, string_list_t * hints) { char uids[HUGE_STRING]; char tmpuids[HUGE_STRING]; diff --git a/lib-crypt/pgpkey.c b/lib-crypt/pgpkey.c index ae3e49b..d9e2de3 100644 --- a/lib-crypt/pgpkey.c +++ b/lib-crypt/pgpkey.c @@ -758,7 +758,7 @@ BODY *pgp_make_key_attachment (char *tempf) return att; } -static LIST *pgp_add_string_to_hints (LIST * hints, const char *str) +static string_list_t *pgp_add_string_to_hints (string_list_t * hints, const char *str) { char *scratch; char *t; @@ -788,7 +788,7 @@ static pgp_key_t *pgp_get_lastp (pgp_key_t p) pgp_key_t pgp_getkeybyaddr (address_t * a, short abilities, pgp_ring_t keyring) { address_t *r, *p; - LIST *hints = NULL; + string_list_t *hints = NULL; int weak = 0; int invalid = 0; @@ -812,7 +812,7 @@ pgp_key_t pgp_getkeybyaddr (address_t * a, short abilities, pgp_ring_t keyring) mutt_message (_("Looking for keys matching \"%s\"..."), a->mailbox); keys = pgp_get_candidates (keyring, hints); - mutt_free_list (&hints); + string_list_wipe(&hints); if (!keys) return NULL; @@ -860,7 +860,7 @@ pgp_key_t pgp_getkeybyaddr (address_t * a, short abilities, pgp_ring_t keyring) this_key_has_weak = 1; } - address_delete (&r); + address_list_wipe(&r); } if (match && !this_key_has_strong && this_key_has_invalid) @@ -906,7 +906,7 @@ pgp_key_t pgp_getkeybyaddr (address_t * a, short abilities, pgp_ring_t keyring) pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring) { - LIST *hints = NULL; + string_list_t *hints = NULL; pgp_key_t keys; pgp_key_t matches = NULL; pgp_key_t *last = &matches; @@ -918,7 +918,7 @@ pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring) hints = pgp_add_string_to_hints (hints, p); keys = pgp_get_candidates (keyring, hints); - mutt_free_list (&hints); + string_list_wipe(&hints); if (!keys) return NULL; diff --git a/lib-crypt/smime.c b/lib-crypt/smime.c index 5c4cf77..1683a87 100644 --- a/lib-crypt/smime.c +++ b/lib-crypt/smime.c @@ -720,7 +720,7 @@ void smime_getkeys (ENVELOPE * env) } if (!found && (t = mutt_default_from ())) { _smime_getkeys (t->mailbox); - address_delete (&t); + address_list_wipe(&t); } } @@ -777,8 +777,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); - address_delete (&tmp); - address_delete (&addr); + address_list_wipe(&tmp); + address_list_wipe(&addr); return NULL; } @@ -787,10 +787,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); - address_delete (&addr); + address_list_wipe(&addr); } - address_delete (&tmp); + address_list_wipe(&tmp); return (keylist); } diff --git a/lib-lib/list.c b/lib-lib/list.c index 74c60c7..39ad786 100644 --- a/lib-lib/list.c +++ b/lib-lib/list.c @@ -29,33 +29,29 @@ #include "str.h" #include "list.h" -LIST *mutt_copy_list(LIST *p) { - LIST *t, *r = NULL, *l = NULL; +string_list_t *string_list_dup(const string_list_t *p) { + string_list_t *res = NULL; + string_list_t **last = &res; for (; p; p = p->next) { - t = p_new(LIST, 1); - t->data = m_strdup(p->data); - t->next = NULL; - if (l) { - r->next = t; - r = r->next; - } else { - l = r = t; - } + *last = string_item_new(); + (*last)->data = m_strdup(p->data); + last = &(*last)->next; } - return l; + + return res; } -LIST *mutt_add_list_n(LIST *head, const void *data, size_t len) { - LIST *tmp; +string_list_t *mutt_add_list_n(string_list_t *head, const void *data, size_t len) { + string_list_t *tmp; for (tmp = head; tmp && tmp->next; tmp = tmp->next); if (tmp) { - tmp->next = p_new(LIST, 1); + tmp->next = p_new(string_list_t, 1); tmp = tmp->next; } else { - head = tmp = p_new(LIST, 1); + head = tmp = p_new(string_list_t, 1); } tmp->data = p_dup((const char *)data, len); @@ -63,15 +59,3 @@ LIST *mutt_add_list_n(LIST *head, const void *data, size_t len) { return head; } -void mutt_free_list(LIST **list) { - LIST *p; - - if (list) { - while (*list) { - p = *list; - *list = (*list)->next; - p_delete(&p->data); - p_delete(&p); - } - } -} diff --git a/lib-lib/list.h b/lib-lib/list.h index 245a866..918eff8 100644 --- a/lib-lib/list.h +++ b/lib-lib/list.h @@ -25,26 +25,10 @@ #ifndef MUTT_LIB_LIB_LIST_H #define MUTT_LIB_LIB_LIST_H +#include "mem.h" #include "str.h" -typedef struct list_t { - char *data; - struct list_t *next; -} LIST; - -#define mutt_new_list() p_new(LIST, 1) -void mutt_free_list(LIST **); - -LIST *mutt_copy_list(LIST *); - -/* add an element to a list */ -LIST *mutt_add_list_n(LIST*, const void*, size_t len); -static inline LIST *mutt_add_list(LIST *head, const char *data) { - size_t len = m_strlen(data); - return mutt_add_list_n(head, data, len ? len + 1 : 0); -} - -#define DO_SLIST(type, prefix) \ +#define DO_SLIST(type, prefix, dtor) \ static inline type *prefix##_list_pop(type **list) { \ if (*list) { \ type *res = *list; \ @@ -76,18 +60,35 @@ static inline LIST *mutt_add_list(LIST *head, const char *data) { *list = NULL; \ return list; \ } \ - static inline void prefix##_list_wipe(type **list, int del) { \ - if (del) { \ - while (*list) { \ - type *item = prefix##_list_pop(list); \ - prefix##_delete(&item); \ - } \ - } else { \ - *list = NULL; \ + static inline void prefix##_list_wipe(type **list) { \ + while (*list) { \ + type *item = prefix##_list_pop(list); \ + dtor(&item); \ } \ } \ +typedef struct string_list_t { + struct string_list_t *next; + char *data; +} string_list_t; + +DO_INIT(string_list_t, string_item); +static inline void string_item_wipe(string_list_t *it) { + p_delete(&it->data); +} +DO_NEW(string_list_t, string_item); +DO_DELETE(string_list_t, string_item); +DO_SLIST(string_list_t, string, string_item_delete); + +string_list_t *string_list_dup(const string_list_t *); + +/* add an element to a list */ +string_list_t *mutt_add_list_n(string_list_t*, const void*, size_t len); +static inline string_list_t *mutt_add_list(string_list_t *head, const char *data) { + size_t len = m_strlen(data); + return mutt_add_list_n(head, data, len ? len + 1 : 0); +} diff --git a/lib-mime/mime-types.h b/lib-mime/mime-types.h index 59fe54e..513f121 100644 --- a/lib-mime/mime-types.h +++ b/lib-mime/mime-types.h @@ -82,12 +82,14 @@ typedef struct address_t { } address_t; DO_INIT(address_t, address); -void address_wipe(address_t *); +static inline void address_wipe(address_t *addr) { + p_delete(&addr->personal); + p_delete(&addr->mailbox); +} DO_NEW(address_t, address); DO_DELETE(address_t, address); -DO_SLIST(address_t, address); - +DO_SLIST(address_t, address, address_delete); /****************************************************************************/ /* rfc822 header parameters */ @@ -100,11 +102,14 @@ typedef struct parameter { } PARAMETER; DO_INIT(PARAMETER, parameter); -void parameter_wipe(PARAMETER *); +static inline void parameter_wipe(PARAMETER *param) { + p_delete(¶m->attribute); + p_delete(¶m->value); +} DO_NEW(PARAMETER, parameter); DO_DELETE(PARAMETER, parameter); -DO_SLIST(PARAMETER, parameter); +DO_SLIST(PARAMETER, parameter, parameter_delete); /****************************************************************************/ @@ -135,9 +140,9 @@ typedef struct envelope_t { char *x_comment_to; #endif BUFFER *spam; - LIST *references; /* message references (in reverse order) */ - LIST *in_reply_to; /* in-reply-to header content */ - LIST *userhdrs; /* user defined headers */ + string_list_t *references; /* message references (in reverse order) */ + string_list_t *in_reply_to; /* in-reply-to header content */ + string_list_t *userhdrs; /* user defined headers */ unsigned int irt_changed:1; /* In-Reply-To changed to link/break threads */ unsigned int refs_changed:1; /* References changed to break thread */ } ENVELOPE; @@ -316,7 +321,7 @@ see: crypt.h pgplib.h, smime.h */ short attach_total; #ifdef MIXMASTER - LIST *chain; + string_list_t *chain; #endif int refno; /* message number on server */ diff --git a/lib-mime/mime.c b/lib-mime/mime.c index fdb2935..95dabad 100644 --- a/lib-mime/mime.c +++ b/lib-mime/mime.c @@ -48,30 +48,16 @@ const char *BodyEncodings[] = { "x-uuencoded", }; -void address_wipe(address_t *addr) -{ - p_delete(&addr->personal); - p_delete(&addr->mailbox); - address_delete(&addr->next); -} - -void parameter_wipe(PARAMETER *param) -{ - p_delete(¶m->attribute); - p_delete(¶m->value); - parameter_delete(¶m->next); -} - void envelope_wipe(ENVELOPE *p) { - 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); + address_list_wipe(&p->return_path); + address_list_wipe(&p->from); + address_list_wipe(&p->to); + address_list_wipe(&p->cc); + address_list_wipe(&p->bcc); + address_list_wipe(&p->sender); + address_list_wipe(&p->reply_to); + address_list_wipe(&p->mail_followup_to); p_delete(&p->list_post); p_delete(&p->subject); @@ -89,9 +75,9 @@ void envelope_wipe(ENVELOPE *p) #endif mutt_buffer_free (&p->spam); - mutt_free_list(&p->references); - mutt_free_list(&p->in_reply_to); - mutt_free_list(&p->userhdrs); + string_list_wipe(&p->references); + string_list_wipe(&p->in_reply_to); + string_list_wipe(&p->userhdrs); } void header_wipe(HEADER *h) @@ -102,7 +88,7 @@ void header_wipe(HEADER *h) p_delete(&h->tree); p_delete(&h->path); #ifdef MIXMASTER - mutt_free_list(&h->chain); + string_list_wipe(&h->chain); #endif p_delete(&h->data); } @@ -117,7 +103,7 @@ int url_parse_mailto(ENVELOPE *e, char **body, const char *src) int taglen; - LIST **last = &e->userhdrs; + string_list_t **last = &e->userhdrs; if (!(t = strchr (src, ':'))) return -1; diff --git a/lib-mime/mime.h b/lib-mime/mime.h index f8e6fe8..8eb4511 100644 --- a/lib-mime/mime.h +++ b/lib-mime/mime.h @@ -61,7 +61,7 @@ int url_parse_mailto(ENVELOPE *e, char **body, const char *src); extern const char RFC822Specials[]; ssize_t mutt_read_rfc822_line(FILE*, char**, ssize_t*); -LIST *mutt_parse_references(char *, int); +string_list_t *mutt_parse_references(char *, int); int mutt_check_encoding(const char *); int mutt_check_mime_type(const char *); void mutt_parse_content_type(char *, BODY *); @@ -69,8 +69,8 @@ BODY *mutt_read_mime_header (FILE *, int); void mutt_parse_part(FILE *, BODY *); BODY *mutt_parse_messageRFC822(FILE *, BODY *); BODY *mutt_parse_multipart(FILE *, const char *, off_t, int); -LIST **mutt_parse_rfc822_line(ENVELOPE *, HEADER *, char *line, char *p, - short weed, short do_2047, LIST **); +string_list_t **mutt_parse_rfc822_line(ENVELOPE *, HEADER *, char *line, char *p, + short weed, short do_2047, string_list_t **); ENVELOPE *mutt_read_rfc822_header(FILE *, HEADER *, short, short); int mutt_count_body_parts (HEADER *hdr, int flags); diff --git a/lib-mime/rfc2231.c b/lib-mime/rfc2231.c index e7c1053..e1eec1e 100644 --- a/lib-mime/rfc2231.c +++ b/lib-mime/rfc2231.c @@ -141,7 +141,7 @@ static void purge_empty_parameters(PARAMETER **headp) if (!p->attribute || !p->value) { *headp = p->next; p->next = NULL; - parameter_delete(&p); + parameter_list_wipe(&p); } else { headp = &(*headp)->next; } diff --git a/lib-mime/rfc822address.c b/lib-mime/rfc822address.c index 0b06c05..a76fd25 100644 --- a/lib-mime/rfc822address.c +++ b/lib-mime/rfc822address.c @@ -250,7 +250,7 @@ address_t **rfc822_eotoken(address_t **last, static_buf *phrase, static_buf *com s = parse_address(phrase->buf, comment, cur); if (s && *s && *s != ',' && *s != ';') { - address_delete(&cur); + address_list_wipe(&cur); return last; } @@ -281,7 +281,7 @@ address_t *rfc822_parse_adrlist(address_t *top, const char *s) stbuf_append_sp(&phrase); s = next_phrase(s, &phrase); if (!s) { - address_delete(&top); + address_list_wipe(&top); return NULL; } continue; @@ -290,7 +290,7 @@ address_t *rfc822_parse_adrlist(address_t *top, const char *s) stbuf_append_sp(&comment); s = parse_comment(s + 1, &comment); if (!s) { - address_delete(&top); + address_list_wipe(&top); return NULL; } continue; @@ -305,8 +305,8 @@ address_t *rfc822_parse_adrlist(address_t *top, const char *s) s = parse_address(skipspaces(s + 1), &comment, cur); if (!s || *s != '>' || !cur->mailbox) { - address_delete(&top); - address_delete(&cur); + address_list_wipe(&top); + address_list_wipe(&cur); return NULL; } diff --git a/lib-mime/rfc822parse.c b/lib-mime/rfc822parse.c index 1eee71a..9643aee 100644 --- a/lib-mime/rfc822parse.c +++ b/lib-mime/rfc822parse.c @@ -99,9 +99,9 @@ ssize_t mutt_read_rfc822_line(FILE *f, char **line, ssize_t *n) } /* TODO: Make that a string list somehow */ -LIST *mutt_parse_references(char *s, int in_reply_to) +string_list_t *mutt_parse_references(char *s, int in_reply_to) { - LIST *lst = NULL; + string_list_t *lst = NULL; int n = 0; char *o = NULL; @@ -142,14 +142,14 @@ LIST *mutt_parse_references(char *s, int in_reply_to) */ if (new) { char *at = strchr(new, '@'); - LIST *tmp; + string_list_t *tmp; if (!at || strchr(at + 1, '@') || (in_reply_to && at - new <= 8)) { p_delete(&new); continue; } - tmp = p_new(LIST, 1); + tmp = p_new(string_list_t, 1); tmp->data = new; tmp->next = lst; lst = tmp; @@ -281,7 +281,7 @@ void mutt_parse_content_type(char *s, BODY *ct) char *subtype; p_delete(&ct->subtype); - parameter_delete(&ct->parameter); + parameter_list_wipe(&ct->parameter); /* First extract any existing parameters */ if ((pc = strchr(s, ';')) != NULL) { @@ -372,7 +372,7 @@ static void parse_content_disposition(char *s, BODY *ct) if ((s = mutt_get_parameter ("name", parms))) ct->form_name = m_strdup(s); - parameter_delete(&parms); + parameter_list_wipe(&parms); } } @@ -794,8 +794,8 @@ time_t mutt_parse_date(const char *s, HEADER *h) return mutt_mktime(&tm, 0) + (zoccident ? 1 : -1) * (zhours * 3600 + zminutes * 60); } -LIST **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p, - short weed, short do_2047, LIST **user_hdrs) +string_list_t **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p, + short weed, short do_2047, string_list_t **user_hdrs) { switch (mime_which_token(line, -1)) { case MIME_APPARENTLY_FROM: @@ -876,7 +876,7 @@ LIST **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p, break; case MIME_IN_REPLY_TO: - mutt_free_list(&e->in_reply_to); + string_list_wipe(&e->in_reply_to); e->in_reply_to = mutt_parse_references(p, 1); break; @@ -913,7 +913,7 @@ LIST **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p, break; case MIME_MAIL_REPLY_TO: - address_delete (&e->reply_to); + address_list_wipe(&e->reply_to); e->reply_to = rfc822_parse_adrlist(e->reply_to, p); break; @@ -956,7 +956,7 @@ LIST **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p, break; case MIME_REFERENCES: - mutt_free_list(&e->references); + string_list_wipe(&e->references); e->references = mutt_parse_references(p, 0); break; @@ -1057,7 +1057,7 @@ LIST **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, char *p, break; } - *user_hdrs = mutt_new_list(); + *user_hdrs = string_item_new(); (*user_hdrs)->data = m_strdup(line); if (do_2047) rfc2047_decode(&(*user_hdrs)->data); @@ -1089,7 +1089,7 @@ ENVELOPE * mutt_read_rfc822_header(FILE *f, HEADER *hdr, short user_hdrs, short weed) { ENVELOPE *e = envelope_new(); - LIST **last = user_hdrs ? &e->userhdrs : NULL; + string_list_t **last = user_hdrs ? &e->userhdrs : NULL; char *line = p_new(char, LONG_STRING); ssize_t linelen = LONG_STRING; @@ -1185,9 +1185,9 @@ mutt_read_rfc822_header(FILE *f, HEADER *hdr, short user_hdrs, short weed) } /* Compares mime types to the ok and except lists */ -static int count_body_parts_check(LIST **checklist, BODY *b) +static int count_body_parts_check(string_list_t **checklist, BODY *b) { - LIST *type; + string_list_t *type; for (type = *checklist; type; type = type->next) { ATTACH_MATCH *a = (ATTACH_MATCH *)type->data; diff --git a/lib-sys/mutt_ssl.c b/lib-sys/mutt_ssl.c index b247377..c7dcc7a 100644 --- a/lib-sys/mutt_ssl.c +++ b/lib-sys/mutt_ssl.c @@ -382,7 +382,7 @@ static int check_certificate_cache (X509 *peercert) { unsigned char peermd[EVP_MAX_MD_SIZE]; unsigned int peermdlen; X509 *cert; - LIST *scert; + string_list_t *scert; if (!X509_digest (peercert, EVP_sha1(), peermd, &peermdlen)) return 0; diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index 0fd125a..60da260 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -751,7 +751,7 @@ int mutt_index_menu (void) break; } else { - LIST *ref = CURHDR->env->references; + string_list_t *ref = CURHDR->env->references; if (!ref) { mutt_error (_("Article has no parent reference!")); @@ -807,7 +807,7 @@ int mutt_index_menu (void) m_strcpy(buf, sizeof(buf), CURHDR->env->message_id); if (op == OP_RECONSTRUCT_THREAD) { - LIST *ref = CURHDR->env->references; + string_list_t *ref = CURHDR->env->references; while (ref) { nntp_check_msgid (Context, ref->data); diff --git a/main.c b/main.c index 4ea57e1..beade2d 100644 --- a/main.c +++ b/main.c @@ -506,10 +506,10 @@ int main (int argc, char **argv) char *draftFile = NULL; char *newMagic = NULL; HEADER *msg = NULL; - LIST *attach = NULL; - LIST *commands = NULL; - LIST *queries = NULL; - LIST *alias_queries = NULL; + string_list_t *attach = NULL; + string_list_t *commands = NULL; + string_list_t *queries = NULL; + string_list_t *alias_queries = NULL; int sendflags = 0; int flags = 0; int version = 0; @@ -706,7 +706,7 @@ int main (int argc, char **argv) /* set defaults and read init files */ mx_init (); mutt_init (flags & M_NOSYSRC, commands); - mutt_free_list (&commands); + string_list_wipe(&commands); /* Initialize crypto */ crypt_init (); @@ -862,7 +862,7 @@ int main (int argc, char **argv) p_delete(&bodytext); if (attach) { - LIST *t = attach; + string_list_t *t = attach; BODY *a = NULL; while (t) { @@ -876,12 +876,12 @@ int main (int argc, char **argv) if (!option (OPTNOCURSES)) mutt_endwin (NULL); fprintf (stderr, _("%s: unable to attach file.\n"), t->data); - mutt_free_list (&attach); + string_list_wipe(&attach); exit (1); } t = t->next; } - mutt_free_list (&attach); + string_list_wipe(&attach); } ci_send_message (sendflags, msg, tempfile, NULL, NULL); diff --git a/mutt.h b/mutt.h index b1270ea..75e19ec 100644 --- a/mutt.h +++ b/mutt.h @@ -517,9 +517,9 @@ typedef struct spam_list_t { #define mutt_new_spam_list() p_new(SPAM_LIST, 1) void mutt_free_spam_list (SPAM_LIST **); -int mutt_matches_ignore (const char *, LIST *); +int mutt_matches_ignore (const char *, string_list_t *); -void mutt_init (int, LIST *); +void mutt_init (int, string_list_t *); typedef struct thread { unsigned int fake_thread:1; diff --git a/muttlib.c b/muttlib.c index 27cbdbd..00d0e90 100644 --- a/muttlib.c +++ b/muttlib.c @@ -176,7 +176,7 @@ void mutt_free_body (BODY ** p) a = a->next; if (b->parameter) - parameter_delete(&b->parameter); + parameter_list_wipe(&b->parameter); if (b->unlink && b->filename) { debug_print (1, ("unlinking %s.\n", b->filename)); unlink (b->filename); @@ -216,7 +216,7 @@ HEADER *mutt_dup_header (HEADER * h) } /* returns true if the header contained in "s" is in list "t" */ -int mutt_matches_ignore (const char *s, LIST * t) +int mutt_matches_ignore (const char *s, string_list_t * t) { for (; t; t = t->next) { if (!ascii_strncasecmp (s, t->data, m_strlen(t->data)) @@ -441,7 +441,7 @@ void mutt_delete_parameter (const char *attribute, PARAMETER ** p) if (ascii_strcasecmp (attribute, q->attribute) == 0) { *p = q->next; q->next = NULL; - parameter_delete(&q); + parameter_list_wipe(&q); return; } } @@ -534,7 +534,7 @@ void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra) /* spam and user headers should never be hashed, and the new envelope may * have better values. Use new versions regardless. */ mutt_buffer_free (&base->spam); - mutt_free_list (&base->userhdrs); + string_list_wipe(&base->userhdrs); MOVE_ELEM(spam); MOVE_ELEM(userhdrs); #undef MOVE_ELEM @@ -1272,7 +1272,7 @@ int mutt_cmp_addr (const address_t * a, const address_t * b) return (1); } -int mutt_cmp_list (const LIST * a, const LIST * b) +int mutt_cmp_list (const string_list_t * a, const string_list_t * b) { while (a && b) { if (m_strcmp(a->data, b->data)) diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 97703d7..29b427c 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -38,12 +38,12 @@ void nntp_add_to_list (NNTP_SERVER * s, NNTP_DATA * d) { - LIST *l; + string_list_t *l; if (!s || !d) return; - l = p_new(LIST, 1); + l = p_new(string_list_t, 1); if (s->list) s->tail->next = l; else @@ -331,7 +331,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server) { char file[_POSIX_PATH_MAX]; char *buf, *p; - LIST *list; + string_list_t *list; ACCOUNT acct; NNTP_SERVER *serv; CONNECTION *conn; @@ -406,7 +406,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server) hash_destroy (&serv->newsgroups, nntp_delete_data); for (list = serv->list; list; list = list->next) list->data = NULL; - mutt_free_list (&serv->list); + string_list_wipe(&serv->list); p_delete(&serv->newsrc); p_delete(&serv->cache); p_delete(&serv); @@ -745,7 +745,7 @@ int mutt_newsrc_update (NNTP_SERVER * news) { char *buf, *line; NNTP_DATA *data; - LIST *tmp; + string_list_t *tmp; int r = -1; size_t len, llen; @@ -821,7 +821,7 @@ static int nntp_update_cacheindex (NNTP_SERVER * serv, NNTP_DATA * data) void nntp_clear_cacheindex (NNTP_SERVER * news) { NNTP_DATA *data; - LIST *tmp; + string_list_t *tmp; if (option (OPTSAVEUNSUB) || !news) return; @@ -842,7 +842,7 @@ int nntp_save_cache_index (NNTP_SERVER * news) char file[_POSIX_PATH_MAX]; NNTP_DATA *d; FILE *f; - LIST *l; + string_list_t *l; if (!news || !news->newsgroups) return -1; @@ -1078,7 +1078,7 @@ NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER * news, char *group) /* this routine gives the first newsgroup with new messages */ void nntp_buffy (char* dst, size_t dstlen) { - LIST *list; + string_list_t *list; int count = 0; /* forward to current group */ diff --git a/nntp/nntp.c b/nntp/nntp.c index 159d2e1..2977f0c 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -533,7 +533,7 @@ static void nntp_get_desc (NNTP_DATA * data, const char *mask, char *msg, progre if (data->nserv->hasXGTITLE) snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask); else - snprintf (buf, sizeof (buf), "LIST NEWSGROUPS %s\r\n", mask); + snprintf (buf, sizeof (buf), "string_list_t NEWSGROUPS %s\r\n", mask); if (mutt_nntp_fetch (data, buf, msg, bar, parse_description, data->nserv, 0) != 0) { #ifdef DEBUG @@ -584,7 +584,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) hdr->env->subject = m_strdup(b); break; case 2: - address_delete (&hdr->env->from); + address_list_wipe(&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 @@ -605,7 +605,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) hdr->env->message_id = m_strdup(b); break; case 5: - mutt_free_list (&hdr->env->references); + string_list_wipe(&hdr->env->references); hdr->env->references = mutt_parse_references (b, 0); break; case 6: @@ -893,7 +893,7 @@ int nntp_open_mailbox (CONTEXT * ctx) } if (m_strncmp("211", buf, 3)) { - LIST *l = serv->list; + string_list_t *l = serv->list; /* GROUP command failed */ if (!m_strncmp("411", buf, 3)) { @@ -1314,8 +1314,8 @@ int nntp_check_newgroups (NNTP_SERVER * serv, int force) { char buf[LONG_STRING]; NNTP_DATA nntp_data; - LIST *l; - LIST emp; + string_list_t *l; + string_list_t emp; time_t now; struct tm *t; @@ -1412,7 +1412,7 @@ int nntp_get_active (NNTP_SERVER * serv) { char msg[SHORT_STRING]; NNTP_DATA nntp_data; - LIST *tmp; + string_list_t *tmp; if (nntp_open_connection (serv) < 0) return -1; @@ -1425,9 +1425,9 @@ int nntp_get_active (NNTP_SERVER * serv) nntp_data.nserv = serv; nntp_data.group = NULL; - if (mutt_nntp_fetch (&nntp_data, "LIST\r\n", msg, NULL, add_group, serv, 0) < 0) { + if (mutt_nntp_fetch (&nntp_data, "string_list_t\r\n", msg, NULL, add_group, serv, 0) < 0) { #ifdef DEBUG - nntp_error ("nntp_get_active()", "LIST\r\n"); + nntp_error ("nntp_get_active()", "string_list_t\r\n"); #endif return -1; } diff --git a/nntp/nntp.h b/nntp/nntp.h index 2ef79de..a111b67 100644 --- a/nntp/nntp.h +++ b/nntp/nntp.h @@ -48,8 +48,8 @@ typedef struct { time_t newgroups_time; time_t check_time; HASH *newsgroups; - LIST *list; /* list of newsgroups */ - LIST *tail; /* last entry of list */ + string_list_t *list; /* list of newsgroups */ + string_list_t *tail; /* last entry of list */ CONNECTION *conn; } NNTP_SERVER; diff --git a/pattern.c b/pattern.c index 95157b1..8ace17a 100644 --- a/pattern.c +++ b/pattern.c @@ -892,7 +892,7 @@ static int match_adrlist (pattern_t* pat, int match_personal, int alladdr __attr return pat->alladdr; /* No matches, or all matches if alladdr */ } -static int match_reference (pattern_t* pat, LIST * refs) +static int match_reference (pattern_t* pat, string_list_t * refs) { for (; refs; refs = refs->next) if (patmatch (pat, refs->data) == 0) diff --git a/pop/pop.c b/pop/pop.c index 572c79e..a8c2616 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -62,7 +62,7 @@ static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h) return PFD_FUNCT_ERROR; } - snprintf (buf, sizeof (buf), "LIST %d\r\n", h->refno); + snprintf (buf, sizeof (buf), "string_list_t %d\r\n", h->refno); ret = pop_query (pop_data, buf, sizeof (buf)); if (ret == PQ_OK) { sscanf (buf, "+OK %d %ld", &index, &length); diff --git a/postpone.c b/postpone.c index 945a704..0087e3f 100644 --- a/postpone.c +++ b/postpone.c @@ -233,9 +233,9 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, { HEADER *h; int code = SENDPOSTPONED; - LIST *tmp; - LIST *last = NULL; - LIST *next; + string_list_t *tmp; + string_list_t *last = NULL; + string_list_t *next; char *p; int opt_delete; @@ -309,7 +309,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, else hdr->env->userhdrs = tmp->next; tmp->next = NULL; - mutt_free_list (&tmp); + string_list_wipe(&tmp); tmp = next; if (*cur) code |= SENDREPLY; @@ -326,7 +326,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, else hdr->env->userhdrs = tmp->next; tmp->next = NULL; - mutt_free_list (&tmp); + string_list_wipe(&tmp); tmp = next; } else if ((m_strncmp("Pgp:", tmp->data, 4) == 0 /* this is generated @@ -343,7 +343,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, else hdr->env->userhdrs = tmp->next; tmp->next = NULL; - mutt_free_list (&tmp); + string_list_wipe(&tmp); tmp = next; } else if (m_strncmp("X-Mutt-SMIME:", tmp->data, 13) == 0) { @@ -357,7 +357,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, else hdr->env->userhdrs = tmp->next; tmp->next = NULL; - mutt_free_list (&tmp); + string_list_wipe(&tmp); tmp = next; } @@ -365,7 +365,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, else if (m_strncmp("X-Mutt-Mix:", tmp->data, 11) == 0) { char *t; - mutt_free_list (&hdr->chain); + string_list_wipe(&hdr->chain); t = strtok (tmp->data + 11, " \t\n"); while (t) { @@ -379,7 +379,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc, else hdr->env->userhdrs = tmp->next; tmp->next = NULL; - mutt_free_list (&tmp); + string_list_wipe(&tmp); tmp = next; } #endif diff --git a/protos.h b/protos.h index 0b6616e..4f9c2ef 100644 --- a/protos.h +++ b/protos.h @@ -59,13 +59,13 @@ BODY *mutt_new_body(void); CONTENT *mutt_get_content_info (const char *fname, BODY * b); -LIST *mutt_make_references (ENVELOPE * e); +string_list_t *mutt_make_references (ENVELOPE * e); HEADER *mutt_dup_header (HEADER *); int mutt_cmp_header (const HEADER*, const HEADER*); int mutt_cmp_addr (const address_t * a, const address_t * b); -int mutt_cmp_list (const LIST * a, const LIST * b); +int mutt_cmp_list (const string_list_t * a, const string_list_t * b); int mutt_cmp_env (const ENVELOPE * e1, const ENVELOPE * e2); int mutt_cmp_param (const PARAMETER * p1, const PARAMETER * p2); int mutt_cmp_body (const BODY * b1, const BODY * b2); @@ -93,7 +93,7 @@ const char *mutt_fqdn (short); void mutt_account_hook (const char *url); void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv, - LIST *** pp, LIST *** qq); + string_list_t *** pp, string_list_t *** qq); void mutt_adv_mktemp (const char*, char*, size_t); int mutt_bounce_message (FILE * fp, HEADER *, address_t *); void mutt_canonical_charset (char *, size_t, const char *); @@ -167,7 +167,7 @@ void mutt_tabs_to_spaces (char *); void mutt_tag_set_flag (int, int); void mutt_update_encoding (BODY * a); void mutt_version (void); -void mutt_write_references (LIST *, FILE *); +void mutt_write_references (string_list_t *, FILE *); void mutt_write_address_list (address_t * adr, FILE * fp, int linelen, int display); @@ -235,7 +235,7 @@ int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_pattern_func (int, char *); int mutt_query_complete (char *, size_t); -int mutt_query_variables (LIST * queries); +int mutt_query_variables (string_list_t * queries); int _mutt_save_message (HEADER *, CONTEXT *, int, int, int); int mutt_save_message (HEADER *, int, int, int, int *); int mutt_search_command (int, int); diff --git a/query.c b/query.c index c3fe53c..7f343fd 100644 --- 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); - address_delete (&tmpa); + address_list_wipe(&tmpa); 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) { - address_delete (&queryp->addr); + address_list_wipe(&queryp->addr); p_delete(&queryp->name); p_delete(&queryp->other); results = queryp->next; @@ -389,7 +389,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_delete (&a); + address_list_wipe(&a); } break; @@ -439,7 +439,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); - address_delete (&tmpa); + address_list_wipe(&tmpa); } else if (curpos + 2 < buflen) { address_t *tmpa = result_to_addr (QueryTable[i].data); @@ -449,7 +449,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); - address_delete (&tmpa); + address_list_wipe(&tmpa); } } } @@ -459,14 +459,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); - address_delete (&tmpa); + address_list_wipe(&tmpa); } } queryp = results; while (queryp) { - address_delete (&queryp->addr); + address_list_wipe(&queryp->addr); p_delete(&queryp->name); p_delete(&queryp->other); results = queryp->next; diff --git a/recvcmd.c b/recvcmd.c index f504547..b403044 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -158,7 +158,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr __attribute__ ((unused)), if (mutt_addrlist_to_idna (adr, &err) < 0) { mutt_error (_("Bad IDN: '%s'"), err); p_delete(&err); - address_delete (&adr); + address_list_wipe(&adr); return; } @@ -183,7 +183,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr __attribute__ ((unused)), } if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) { - address_delete (&adr); + address_list_wipe(&adr); CLEARLINE (LINES - 1); mutt_message (p ? _("Message not bounced.") : _("Messages not bounced.")); return; @@ -723,7 +723,7 @@ attach_reply_envelope_defaults (ENVELOPE * env, ATTACHPTR ** idx, if (parent) mutt_add_to_reference_headers (env, curenv, NULL, NULL); else { - LIST **p = NULL, **q = NULL; + string_list_t **p = NULL, **q = NULL; for (i = 0; i < idxlen; i++) { if (idx[i]->content->tagged) diff --git a/remailer.c b/remailer.c index 971f197..b40ddbb 100644 --- a/remailer.c +++ b/remailer.c @@ -469,9 +469,9 @@ static struct mapping_t RemailerHelp[] = { }; -void mix_make_chain (LIST ** chainp, int *redraw) +void mix_make_chain (string_list_t ** chainp, int *redraw) { - LIST *p; + string_list_t *p; MIXCHAIN *chain; int c_cur = 0, c_old = 0; int m_len; @@ -502,7 +502,7 @@ void mix_make_chain (LIST ** chainp, int *redraw) for (p = *chainp; p; p = p->next) mix_chain_add (chain, (char *) p->data, type2_list); - mutt_free_list (chainp); + string_list_wipe(chainp); /* safety check */ for (i = 0; i < chain->cl; i++) { @@ -714,7 +714,7 @@ int mix_check_message (HEADER * msg) return 0; } -int mix_send_message (LIST * chain, const char *tempfile) +int mix_send_message (string_list_t * chain, const char *tempfile) { char cmd[HUGE_STRING]; char tmp[HUGE_STRING]; diff --git a/remailer.h b/remailer.h index 8bf8982..7a17db6 100644 --- a/remailer.h +++ b/remailer.h @@ -43,9 +43,9 @@ struct mixchain { typedef struct mixchain MIXCHAIN; -int mix_send_message (LIST *, const char *); +int mix_send_message (string_list_t *, const char *); int mix_check_message (HEADER * msg); -void mix_make_chain (LIST **, int *); +void mix_make_chain (string_list_t **, int *); #endif /* MIXMASTER */ diff --git a/send.c b/send.c index eb57837..395ecb0 100644 --- a/send.c +++ b/send.c @@ -110,13 +110,13 @@ static address_t *mutt_remove_xrefs (address_t * a, address_t * b) if (prev) { prev->next = b->next; b->next = NULL; - address_delete (&b); + address_list_wipe(&b); b = prev; } else { top = top->next; b->next = NULL; - address_delete (&b); + address_list_wipe(&b); b = top; } } @@ -152,7 +152,7 @@ static address_t *remove_user (address_t * a, int leave_only) a = a->next; if (!leave_only || a || last) { tmp->next = NULL; - address_delete (&tmp); + address_list_wipe(&tmp); } else last = top = tmp; @@ -192,7 +192,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); - address_delete (a); + address_list_wipe(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); @@ -208,7 +208,7 @@ static int edit_address (address_t ** a, const char *field) static int edit_envelope (ENVELOPE * en, int flags) { char buf[HUGE_STRING]; - LIST *uh = UserHeader; + string_list_t *uh = UserHeader; regmatch_t pat_match[1]; #ifdef USE_NNTP @@ -310,7 +310,7 @@ char *nntp_get_header(const char *s) static void process_user_recips (ENVELOPE * env) { - LIST *uh = UserHeader; + string_list_t *uh = UserHeader; for (; uh; uh = uh->next) { if (ascii_strncasecmp ("to:", uh->data, 3) == 0) @@ -332,8 +332,8 @@ static void process_user_recips (ENVELOPE * env) static void process_user_header (ENVELOPE * env) { - LIST *uh = UserHeader; - LIST *last = env->userhdrs; + string_list_t *uh = UserHeader; + string_list_t *last = env->userhdrs; if (last) while (last->next) @@ -342,11 +342,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 */ - address_delete (&env->from); + address_list_wipe(&env->from); env->from = rfc822_parse_adrlist (env->from, uh->data + 5); } else if (ascii_strncasecmp ("reply-to:", uh->data, 9) == 0) { - address_delete (&env->reply_to); + address_list_wipe(&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) @@ -362,11 +362,11 @@ static void process_user_header (ENVELOPE * env) ascii_strncasecmp ("supersedes:", uh->data, 11) != 0 && ascii_strncasecmp ("subject:", uh->data, 8) != 0) { if (last) { - last->next = mutt_new_list (); + last->next = string_item_new(); last = last->next; } else - last = env->userhdrs = mutt_new_list (); + last = env->userhdrs = string_item_new(); last->data = m_strdup(uh->data); } } @@ -585,17 +585,17 @@ int mutt_fetch_recips (ENVELOPE * out, ENVELOPE * in, int flags) return 0; } -LIST *mutt_make_references (ENVELOPE * e) +string_list_t *mutt_make_references (ENVELOPE * e) { - LIST *t = NULL, *l = NULL; + string_list_t *t = NULL, *l = NULL; if (e->references) - l = mutt_copy_list (e->references); + l = string_list_dup(e->references); else - l = mutt_copy_list (e->in_reply_to); + l = string_list_dup(e->in_reply_to); if (e->message_id) { - t = mutt_new_list (); + t = string_item_new(); t->data = m_strdup(e->message_id); t->next = l; l = t; @@ -657,9 +657,9 @@ void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx, } void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv, - LIST *** pp, LIST *** qq) + string_list_t *** pp, string_list_t *** qq) { - LIST **p = NULL, **q = NULL; + string_list_t **p = NULL, **q = NULL; if (pp) p = *pp; @@ -679,7 +679,7 @@ void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv, *p = mutt_make_references (curenv); if (curenv->message_id) { - *q = mutt_new_list (); + *q = string_item_new(); (*q)->data = m_strdup(curenv->message_id); } @@ -698,7 +698,7 @@ mutt_make_reference_headers (ENVELOPE * curenv, ENVELOPE * env, CONTEXT * ctx) if (!curenv) { HEADER *h; - LIST **p = NULL, **q = NULL; + string_list_t **p = NULL, **q = NULL; int i; for (i = 0; i < ctx->vcount; i++) { @@ -1174,7 +1174,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. */ - address_delete (&msg->env->from); + address_list_wipe(&msg->env->from); } if (!(flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) { @@ -1302,7 +1302,7 @@ int ci_send_message (int flags, /* send mode */ msg->replied = 0; if (killfrom) { - address_delete (&msg->env->from); + address_list_wipe(&msg->env->from); killfrom = 0; } @@ -1473,7 +1473,7 @@ int ci_send_message (int flags, /* send mode */ } mutt_select_fcc (fcc, sizeof (fcc), msg); if (killfrom) { - address_delete (&msg->env->from); + address_list_wipe(&msg->env->from); killfrom = 0; } } diff --git a/sendlib.c b/sendlib.c index e911fed..a5ba72c 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1406,9 +1406,9 @@ void mutt_write_address_list (address_t * adr, FILE * fp, int linelen, /* need to write the list in reverse because they are stored in reverse order * when parsed to speed up threading */ -void mutt_write_references (LIST * r, FILE * f) +void mutt_write_references (string_list_t * r, FILE * f) { - LIST **ref = NULL; + string_list_t **ref = NULL; int refcnt = 0, refmax = 0; for (; (TrimRef == 0 || refcnt < TrimRef) && r; r = r->next) { @@ -1446,7 +1446,7 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach, { char buffer[LONG_STRING]; char *p; - LIST *tmp = env->userhdrs; + string_list_t *tmp = env->userhdrs; int has_agent = 0; /* user defined user-agent header field exists */ list2_t* hdrs = list_from_str (EditorHeaders, " "); @@ -1602,7 +1602,7 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach, return (ferror (fp) == 0 ? 0 : -1); } -static void encode_headers (LIST * h) +static void encode_headers (string_list_t * h) { char *tmp; char *p; @@ -2171,12 +2171,12 @@ void mutt_prepare_envelope (ENVELOPE * env, int final) void mutt_unprepare_envelope (ENVELOPE * env) { - LIST *item; + string_list_t *item; for (item = env->userhdrs; item; item = item->next) rfc2047_decode (&item->data); - address_delete (&env->mail_followup_to); + address_list_wipe(&env->mail_followup_to); /* back conversions */ rfc2047_decode_adrlist (env->to); @@ -2268,7 +2268,7 @@ int mutt_bounce_message (FILE * fp, HEADER * h, address_t * to) ret = _mutt_bounce_message (fp, h, to, resent_from, from); - address_delete (&from); + address_list_wipe(&from); return ret; } @@ -2297,7 +2297,7 @@ address_t *mutt_remove_duplicates (address_t * addr) *last = addr->next; addr->next = NULL; - address_delete (&addr); + address_list_wipe(&addr); addr = *last; } @@ -2422,7 +2422,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid, */ if (post && hdr->chain && hdr->chain) { - LIST *p; + string_list_t *p; fputs ("X-Mutt-Mix:", msg->fp); for (p = hdr->chain; p; p = p->next) diff --git a/thread.c b/thread.c index ee923b1..ed690f2 100644 --- a/thread.c +++ b/thread.c @@ -316,12 +316,12 @@ void mutt_draw_tree (CONTEXT * ctx) * has no message, we have to make a list of all the subjects of its * most immediate existing descendants. we also note the earliest * date on any of the parents and put it in *dateptr. */ -static LIST *make_subject_list (THREAD * cur, time_t * dateptr) +static string_list_t *make_subject_list (THREAD * cur, time_t * dateptr) { THREAD *start = cur; ENVELOPE *env; time_t thisdate; - LIST *curlist, *oldlist, *newlist, *subjects = NULL; + string_list_t *curlist, *oldlist, *newlist, *subjects = NULL; int rc = 0; for (;;) { @@ -345,7 +345,7 @@ static LIST *make_subject_list (THREAD * cur, time_t * dateptr) break; } if (!curlist || rc > 0) { - newlist = p_new(LIST, 1); + newlist = p_new(string_list_t, 1); newlist->data = env->real_subj; if (oldlist) { newlist->next = oldlist->next; @@ -378,7 +378,7 @@ static THREAD *find_subject (CONTEXT * ctx, THREAD * cur) struct hash_elem *ptr; THREAD *tmp, *last = NULL; int hash; - LIST *subjects = NULL, *oldlist; + string_list_t *subjects = NULL, *oldlist; time_t date = 0; subjects = make_subject_list (cur, &date); @@ -685,7 +685,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) HEADER *cur; int i, oldsort, using_refs = 0; THREAD *thread, *new, *tmp, top; - LIST *ref = NULL; + string_list_t *ref = NULL; /* set Sort to the secondary method to support the set sort_aux=reverse-* * settings. The sorting functions just look at the value of @@ -1236,7 +1236,7 @@ HASH *mutt_make_subj_hash (CONTEXT * ctx) static void clean_references (THREAD * brk, THREAD * cur) { THREAD *p; - LIST *ref = NULL; + string_list_t *ref = NULL; int done = 0; for (; cur; cur = cur->next, done = 0) { @@ -1261,7 +1261,7 @@ static void clean_references (THREAD * brk, THREAD * cur) HEADER *h = cur->message; /* clearing the References: header from obsolete Message-ID(s) */ - mutt_free_list (&ref->next); + string_list_wipe(&ref->next); h->env->refs_changed = h->changed = 1; } @@ -1270,8 +1270,8 @@ static void clean_references (THREAD * brk, THREAD * cur) void mutt_break_thread (HEADER * hdr) { - mutt_free_list (&hdr->env->in_reply_to); - mutt_free_list (&hdr->env->references); + string_list_wipe(&hdr->env->in_reply_to); + string_list_wipe(&hdr->env->references); hdr->env->irt_changed = hdr->env->refs_changed = hdr->changed = 1; clean_references (hdr->thread, hdr->thread->child); } @@ -1283,7 +1283,7 @@ static int link_threads (HEADER * parent, HEADER * child, CONTEXT * ctx) mutt_break_thread (child); - child->env->in_reply_to = mutt_new_list (); + child->env->in_reply_to = string_item_new(); child->env->in_reply_to->data = m_strdup(parent->env->message_id); mutt_set_flag (ctx, child, M_TAG, 0); -- 2.20.1