From 1842f8654792f59d44e169a0d04d26abd8951b8c Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Fri, 17 May 2019 11:55:55 +0000 Subject: [PATCH] Merge AddressNode into Address --- addrbook.c | 4 +- address/address.c | 217 +++++++++---------------- address/address.h | 13 +- address/group.c | 18 +- alias.c | 62 +++---- commands.c | 2 +- config/address.c | 2 +- copy.c | 23 ++- email/envelope.c | 2 +- email/parse.c | 2 +- email/rfc2047.c | 24 +-- hcache/serialize.c | 12 +- hdrline.c | 53 +++--- hook.c | 14 +- init.c | 12 +- mx.c | 6 +- ncrypt/crypt.c | 2 +- ncrypt/crypt_gpgme.c | 20 +-- ncrypt/pgp.c | 10 +- ncrypt/pgpinvoke.c | 3 +- ncrypt/pgpkey.c | 6 +- ncrypt/smime.c | 28 ++-- pattern.c | 21 ++- query.c | 10 +- remailer.c | 6 +- send.c | 78 +++++---- sendlib.c | 25 ++- smtp.c | 20 +-- sort.c | 9 +- test/Makefile.autosetup | 3 +- test/address/mutt_addr_append.c | 42 ----- test/address/mutt_addresslist_parse.c | 4 +- test/address/mutt_addresslist_parse2.c | 4 +- test/main.c | 1 - 34 files changed, 321 insertions(+), 437 deletions(-) delete mode 100644 test/address/mutt_addr_append.c diff --git a/addrbook.c b/addrbook.c index 3a92c0e6a..efafdcd27 100644 --- a/addrbook.c +++ b/addrbook.c @@ -168,8 +168,8 @@ static int alias_sort_address(const void *a, const void *b) r = 1; else { - struct Address *pa = TAILQ_FIRST(pal)->addr; - struct Address *pb = TAILQ_FIRST(pbl)->addr; + struct Address *pa = TAILQ_FIRST(pal); + struct Address *pb = TAILQ_FIRST(pbl); if (pa->personal) { if (pb->personal) diff --git a/address/address.c b/address/address.c index e054680b2..6c1045af0 100644 --- a/address/address.c +++ b/address/address.c @@ -370,7 +370,7 @@ static void add_addrspec(struct AddressList *al, const char *phrase, return; } - mutt_addresslist_append(al, cur); + TAILQ_INSERT_TAIL(al, cur, entries); } /** @@ -400,12 +400,12 @@ int mutt_addresslist_remove(struct AddressList *al, const char *mailbox) return 0; int rc = -1; - struct AddressNode *an, *tmp; - TAILQ_FOREACH_SAFE(an, al, entries, tmp) + struct Address *a, *tmp; + TAILQ_FOREACH_SAFE(a, al, entries, tmp) { - if (mutt_str_strcasecmp(mailbox, an->addr->mailbox) == 0) + if (mutt_str_strcasecmp(mailbox, a->mailbox) == 0) { - mutt_addresslist_free_one(al, an); + mutt_addresslist_free_one(al, a); rc = 0; } } @@ -468,11 +468,11 @@ int mutt_addresslist_parse(struct AddressList *al, const char *s) } else if (commentlen != 0) { - struct AddressNode *last = TAILQ_LAST(al, AddressList); - if (last && last->addr && !last->addr->personal) + struct Address *last = TAILQ_LAST(al, AddressList); + if (last && !last->personal) { terminate_buffer(comment, commentlen); - last->addr->personal = mutt_str_strdup(comment); + last->personal = mutt_str_strdup(comment); } } @@ -509,7 +509,7 @@ int mutt_addresslist_parse(struct AddressList *al, const char *s) terminate_buffer(phrase, phraselen); a->mailbox = mutt_str_strdup(phrase); a->group = 1; - mutt_addresslist_append(al, a); + TAILQ_INSERT_TAIL(al, a, entries); phraselen = 0; commentlen = 0; s++; @@ -525,16 +525,16 @@ int mutt_addresslist_parse(struct AddressList *al, const char *s) } else if (commentlen != 0) { - struct AddressNode *last = TAILQ_LAST(al, AddressList); - if (last && last->addr && !last->addr->personal) + struct Address *last = TAILQ_LAST(al, AddressList); + if (last && !last->personal) { terminate_buffer(comment, commentlen); - last->addr->personal = mutt_str_strdup(comment); + last->personal = mutt_str_strdup(comment); } } /* add group terminator */ - mutt_addresslist_append(al, mutt_addr_new()); + TAILQ_INSERT_TAIL(al, mutt_addr_new(), entries); phraselen = 0; commentlen = 0; @@ -553,7 +553,7 @@ int mutt_addresslist_parse(struct AddressList *al, const char *s) mutt_addr_free(&a); return 0; } - mutt_addresslist_append(al, a); + TAILQ_INSERT_TAIL(al, a, entries); phraselen = 0; commentlen = 0; parsed++; @@ -584,11 +584,11 @@ int mutt_addresslist_parse(struct AddressList *al, const char *s) } else if (commentlen != 0) { - struct AddressNode *last = TAILQ_LAST(al, AddressList); - if (last && last->addr && !last->addr->personal) + struct Address *last = TAILQ_LAST(al, AddressList); + if (last && !last->personal) { terminate_buffer(comment, commentlen); - last->addr->personal = mutt_str_strdup(comment); + last->personal = mutt_str_strdup(comment); } } @@ -644,16 +644,15 @@ void mutt_addresslist_qualify(struct AddressList *al, const char *host) if (!al || !host || !*host) return; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - struct Address *addr = an->addr; - if (!addr->group && addr->mailbox && !strchr(addr->mailbox, '@')) + if (!a->group && a->mailbox && !strchr(a->mailbox, '@')) { - char *p = mutt_mem_malloc(mutt_str_strlen(addr->mailbox) + mutt_str_strlen(host) + 2); - sprintf(p, "%s@%s", addr->mailbox, host); - FREE(&addr->mailbox); - addr->mailbox = p; + char *p = mutt_mem_malloc(mutt_str_strlen(a->mailbox) + mutt_str_strlen(host) + 2); + sprintf(p, "%s@%s", a->mailbox, host); + FREE(&a->mailbox); + a->mailbox = p; } } } @@ -726,18 +725,17 @@ void mutt_addresslist_copy(struct AddressList *dst, const struct AddressList *sr if (!dst || !src) return; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, src, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, src, entries) { - struct Address *addr = an->addr; - struct AddressNode *next = TAILQ_NEXT(an, entries); - if (prune && addr->group && (!next || !next->addr->mailbox)) + struct Address *next = TAILQ_NEXT(a, entries); + if (prune && a->group && (!next || !next->mailbox)) { /* ignore this element of the list */ } else { - mutt_addresslist_append(dst, mutt_addr_copy(addr)); + TAILQ_INSERT_TAIL(dst, mutt_addr_copy(a), entries); } } } @@ -804,13 +802,13 @@ bool mutt_addresslist_equal(const struct AddressList *ala, const struct AddressL return !(ala || alb); } - struct AddressNode *ana = TAILQ_FIRST(ala); - struct AddressNode *anb = TAILQ_FIRST(alb); + struct Address *ana = TAILQ_FIRST(ala); + struct Address *anb = TAILQ_FIRST(alb); while (ana && anb) { - if ((mutt_str_strcmp(ana->addr->mailbox, anb->addr->mailbox) != 0) || - (mutt_str_strcmp(ana->addr->personal, anb->addr->personal) != 0)) + if ((mutt_str_strcmp(ana->mailbox, anb->mailbox) != 0) || + (mutt_str_strcmp(ana->personal, anb->personal) != 0)) { break; } @@ -835,10 +833,10 @@ int mutt_addresslist_has_recips(const struct AddressList *al) return 0; int c = 0; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (!an->addr->mailbox || an->addr->group) + if (!a->mailbox || a->group) continue; c++; } @@ -873,10 +871,10 @@ bool mutt_addresslist_search(const struct Address *needle, const struct AddressL if (!needle || !haystack) return false; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, haystack, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, haystack, entries) { - if (mutt_addr_cmp(needle, an->addr)) + if (mutt_addr_cmp(needle, a)) return true; } return false; @@ -1164,15 +1162,15 @@ size_t mutt_addresslist_write(char *buf, size_t buflen, buflen--; } - struct AddressNode *np = NULL; - TAILQ_FOREACH(np, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { if (buflen == 0) break; /* use buflen+1 here because we already saved space for the trailing * nul char, and the subroutine can make use of it */ - mutt_addr_write(pbuf, buflen + 1, np->addr, display); + mutt_addr_write(pbuf, buflen + 1, a, display); /* this should be safe since we always have at least 1 char passed into * the above call, which means 'pbuf' should always be nul terminated */ @@ -1182,8 +1180,8 @@ size_t mutt_addresslist_write(char *buf, size_t buflen, /* if there is another address, and it's not a group mailbox name or * group terminator, add a comma to separate the addresses */ - struct AddressNode *next = TAILQ_NEXT(np, entries); - if (next && next->addr->mailbox && !next->addr->group) + struct Address *next = TAILQ_NEXT(a, entries); + if (next && next->mailbox && !next->group) { if (buflen == 0) goto done; @@ -1218,15 +1216,15 @@ int mutt_addresslist_to_intl(struct AddressList *al, char **err) if (err) *err = NULL; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (!an->addr->mailbox || mutt_addr_is_intl(an->addr)) + if (!a->mailbox || mutt_addr_is_intl(a)) continue; char *user = NULL; char *domain = NULL; - if (mutt_addr_mbox_to_udomain(an->addr->mailbox, &user, &domain) == -1) + if (mutt_addr_mbox_to_udomain(a->mailbox, &user, &domain) == -1) continue; char *intl_mailbox = mutt_idna_local_to_intl(user, domain); @@ -1238,11 +1236,11 @@ int mutt_addresslist_to_intl(struct AddressList *al, char **err) { rc = -1; if (err && !*err) - *err = mutt_str_strdup(an->addr->mailbox); + *err = mutt_str_strdup(a->mailbox); continue; } - mutt_addr_set_intl(an->addr, intl_mailbox); + mutt_addr_set_intl(a, intl_mailbox); } return rc; @@ -1258,15 +1256,15 @@ int mutt_addresslist_to_local(struct AddressList *al) if (!al) return 0; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (!an->addr->mailbox || mutt_addr_is_local(an->addr)) + if (!a->mailbox || mutt_addr_is_local(a)) continue; char *user = NULL; char *domain = NULL; - if (mutt_addr_mbox_to_udomain(an->addr->mailbox, &user, &domain) == -1) + if (mutt_addr_mbox_to_udomain(a->mailbox, &user, &domain) == -1) continue; char *local_mailbox = mutt_idna_intl_to_local(user, domain, 0); @@ -1275,7 +1273,7 @@ int mutt_addresslist_to_local(struct AddressList *al) FREE(&domain); if (local_mailbox) - mutt_addr_set_local(an->addr, local_mailbox); + mutt_addr_set_local(a, local_mailbox); } return 0; } @@ -1292,21 +1290,20 @@ void mutt_addresslist_dedupe(struct AddressList *al) if (!al) return; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (an->addr->mailbox) + if (a->mailbox) { - struct AddressNode *an2 = TAILQ_NEXT(an, entries), *tmp; - if (an2) + struct Address *a2 = TAILQ_NEXT(a, entries), *tmp; + if (a2) { - TAILQ_FOREACH_FROM_SAFE(an2, al, entries, tmp) + TAILQ_FOREACH_FROM_SAFE(a2, al, entries, tmp) { - if (an2->addr->mailbox && - (mutt_str_strcasecmp(an->addr->mailbox, an2->addr->mailbox) == 0)) + if (a2->mailbox && (mutt_str_strcasecmp(a->mailbox, a2->mailbox) == 0)) { - mutt_debug(LL_DEBUG2, "Removing %s\n", an2->addr->mailbox); - mutt_addresslist_free_one(al, an2); + mutt_debug(LL_DEBUG2, "Removing %s\n", a2->mailbox); + mutt_addresslist_free_one(al, a2); } } } @@ -1326,15 +1323,15 @@ void mutt_addresslist_remove_xrefs(const struct AddressList *a, struct AddressLi if (!a || !b) return; - struct AddressNode *ana, *anb, *tmp; + struct Address *aa, *ab, *tmp; - TAILQ_FOREACH_SAFE(anb, b, entries, tmp) + TAILQ_FOREACH_SAFE(ab, b, entries, tmp) { - TAILQ_FOREACH(ana, a, entries) + TAILQ_FOREACH(aa, a, entries) { - if (mutt_addr_cmp(ana->addr, anb->addr)) + if (mutt_addr_cmp(aa, ab)) { - mutt_addresslist_free_one(b, anb); + mutt_addresslist_free_one(b, ab); break; } } @@ -1353,84 +1350,32 @@ struct AddressList *mutt_addresslist_new(void) } /** - * mutt_addresslist_append - Append an address to an AddressList + * mutt_addresslist_free_one - Unlink and free an Address from an AddressList * @param al AddressList - * @param a Address + * @param an Address */ -void mutt_addresslist_append(struct AddressList *al, struct Address *a) +void mutt_addresslist_free_one(struct AddressList *al, struct Address *a) { - if (!al || !a) - return; - - struct AddressNode *anode = mutt_mem_calloc(1, sizeof(struct AddressNode)); - anode->addr = a; - TAILQ_INSERT_TAIL(al, anode, entries); -} - -/** - * mutt_addresslist_prepend - Prepend an address to an AddressList - * @param al AddressList - * @param a Address - */ -void mutt_addresslist_prepend(struct AddressList *al, struct Address *a) -{ - struct AddressNode *anode = mutt_mem_calloc(1, sizeof(struct AddressNode)); - anode->addr = a; - TAILQ_INSERT_HEAD(al, anode, entries); -} - -/** - * mutt_addresslist_free_one - Unlinks an AddressNode from an AddressList and - * frees the referenced Address - * @param al AddressList - * @param an AddressNode - */ -void mutt_addresslist_free_one(struct AddressList *al, struct AddressNode *an) -{ - TAILQ_REMOVE(al, an, entries); - mutt_addr_free(&an->addr); - FREE(&an); + TAILQ_REMOVE(al, a, entries); + mutt_addr_free(&a); } /** - * mutt_addresslist_free_one - Unlinks all AddressNodes from an AddressList, - * frees the referenced Addresses and reinitialize the AddressList. + * mutt_addresslist_free_all - Unlink and free all Address in an AddressList * @param al AddressList + * @note After this call, the AddressList is reinitialized and ready for reuse. */ void mutt_addresslist_free_all(struct AddressList *al) { if (!al) return; - struct AddressNode *np = TAILQ_FIRST(al), *next = NULL; - while (np) + struct Address *a = TAILQ_FIRST(al), *next = NULL; + while (a) { - next = TAILQ_NEXT(np, entries); - mutt_addr_free(&np->addr); - FREE(&np); - np = next; + next = TAILQ_NEXT(a, entries); + mutt_addr_free(&a); + a = next; } TAILQ_INIT(al); } - -/** - * mutt_addresslist_clear - Unlinks all AddressNodes from an AddressList - * and reinitialize the AddressList. - * @param al AddressList - */ -void mutt_addresslist_clear(struct AddressList *al) -{ - struct AddressNode *np = TAILQ_FIRST(al), *next = NULL; - while (np) - { - next = TAILQ_NEXT(np, entries); - FREE(&np); - np = next; - } - TAILQ_INIT(al); -} - -struct Address *mutt_addresslist_first(const struct AddressList *al) -{ - return (al && TAILQ_FIRST(al)) ? TAILQ_FIRST(al)->addr : NULL; -} diff --git a/address/address.h b/address/address.h index 396b87618..c23612fd8 100644 --- a/address/address.h +++ b/address/address.h @@ -37,14 +37,9 @@ struct Address bool group : 1; /**< group mailbox? */ bool is_intl : 1; bool intl_checked : 1; + TAILQ_ENTRY(Address) entries; }; - -struct AddressNode -{ - struct Address *addr; - TAILQ_ENTRY(AddressNode) entries; -}; -TAILQ_HEAD(AddressList, AddressNode); +TAILQ_HEAD(AddressList, Address); /** * enum AddressError - possible values for AddressError @@ -82,9 +77,8 @@ struct AddressList *mutt_addresslist_new(void); void mutt_addresslist_append(struct AddressList *al, struct Address *a); void mutt_addresslist_prepend(struct AddressList *al, struct Address *a); void mutt_addresslist_copy(struct AddressList *dst, const struct AddressList *src, bool prune); -void mutt_addresslist_clear(struct AddressList *al); void mutt_addresslist_free(struct AddressList **al); -void mutt_addresslist_free_one(struct AddressList *al, struct AddressNode *anode); +void mutt_addresslist_free_one(struct AddressList *al, struct Address *anode); void mutt_addresslist_free_all(struct AddressList *al); size_t mutt_addresslist_write(char *buf, size_t buflen, const struct AddressList* addr, bool display); int mutt_addresslist_parse(struct AddressList *top, const char *s); @@ -93,7 +87,6 @@ int mutt_addresslist_to_local(struct AddressList *al); int mutt_addresslist_to_intl(struct AddressList *al, char **err); void mutt_addresslist_dedupe(struct AddressList *al); void mutt_addresslist_qualify(struct AddressList *al, const char *host); -struct Address* mutt_addresslist_first(const struct AddressList *al); bool mutt_addresslist_search(const struct Address *needle, const struct AddressList *haystack); int mutt_addresslist_has_recips(const struct AddressList *al); bool mutt_addresslist_equal(const struct AddressList *ala, const struct AddressList *alb); diff --git a/address/group.c b/address/group.c index 89e692d4b..d16795c6c 100644 --- a/address/group.c +++ b/address/group.c @@ -182,10 +182,10 @@ static void group_add_addrlist(struct Group *g, const struct AddressList *al) struct AddressList new = TAILQ_HEAD_INITIALIZER(new); mutt_addresslist_copy(&new, al, false); mutt_addresslist_remove_xrefs(&g->al, &new); - struct AddressNode *np, *tmp; - TAILQ_FOREACH_SAFE(np, &new, entries, tmp) + struct Address *a, *tmp; + TAILQ_FOREACH_SAFE(a, &new, entries, tmp) { - TAILQ_INSERT_TAIL(&g->al, np, entries); + TAILQ_INSERT_TAIL(&g->al, a, entries); } assert(TAILQ_EMPTY(&new)); } @@ -250,10 +250,10 @@ int mutt_grouplist_remove_addresslist(struct GroupList *head, struct AddressList STAILQ_FOREACH(gnp, head, entries) { - struct AddressNode *anp = NULL; - TAILQ_FOREACH(anp, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - mutt_addresslist_remove(&gnp->group->al, anp->addr->mailbox); + mutt_addresslist_remove(&gnp->group->al, a->mailbox); } if (empty_group(gnp->group)) group_remove(gnp->group); @@ -329,10 +329,10 @@ bool mutt_group_match(struct Group *g, const char *s) if (mutt_regexlist_match(&g->rs, s)) return true; - struct AddressNode *np = NULL; - TAILQ_FOREACH(np, &g->al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, &g->al, entries) { - if (np->addr->mailbox && (mutt_str_strcasecmp(s, np->addr->mailbox) == 0)) + if (a->mailbox && (mutt_str_strcasecmp(s, a->mailbox) == 0)) return true; } diff --git a/alias.c b/alias.c index eda00815f..f44b50c80 100644 --- a/alias.c +++ b/alias.c @@ -63,10 +63,9 @@ static void expand_aliases_r(struct AddressList *al, struct ListHead *expn) bool i; const char *fqdn = NULL; - struct AddressNode *an = TAILQ_FIRST(al); - while (an) + struct Address *a = TAILQ_FIRST(al); + while (a) { - struct Address *a = an->addr; if (!a->group && !a->personal && a->mailbox && !strchr(a->mailbox, '@')) { struct AddressList *alias = mutt_alias_lookup(a->mailbox); @@ -90,13 +89,13 @@ static void expand_aliases_r(struct AddressList *al, struct ListHead *expn) struct AddressList copy = TAILQ_HEAD_INITIALIZER(copy); mutt_addresslist_copy(©, alias, false); expand_aliases_r(©, expn); - struct AddressNode *an2, *tmp; - TAILQ_FOREACH_SAFE(an2, ©, entries, tmp) + struct Address *a2, *tmp; + TAILQ_FOREACH_SAFE(a2, ©, entries, tmp) { - TAILQ_INSERT_BEFORE(an, an2, entries); + TAILQ_INSERT_BEFORE(a, a2, entries); } - an = TAILQ_PREV(an, AddressList, entries); - TAILQ_REMOVE(al, TAILQ_NEXT(an, entries), entries); + a = TAILQ_PREV(a, AddressList, entries); + TAILQ_REMOVE(al, TAILQ_NEXT(a, entries), entries); } } else @@ -112,7 +111,7 @@ static void expand_aliases_r(struct AddressList *al, struct ListHead *expn) } } } - an = TAILQ_NEXT(an, entries); + a = TAILQ_NEXT(a, entries); } if (C_UseDomain && (fqdn = mutt_fqdn(true))) @@ -322,9 +321,9 @@ struct AddressList *mutt_get_address(struct Envelope *env, const char **pfxp) struct AddressList *al = NULL; const char *pfx = NULL; - if (mutt_addr_is_user(mutt_addresslist_first(&env->from))) + if (mutt_addr_is_user(TAILQ_FIRST(&env->from))) { - if (TAILQ_EMPTY(&env->to) && !mutt_is_mail_list(mutt_addresslist_first(&env->to))) + if (TAILQ_EMPTY(&env->to) && !mutt_is_mail_list(TAILQ_FIRST(&env->to))) { pfx = "To"; al = &env->to; @@ -335,8 +334,7 @@ struct AddressList *mutt_get_address(struct Envelope *env, const char **pfxp) al = &env->cc; } } - else if (!TAILQ_EMPTY(&env->reply_to) && - !mutt_is_mail_list(mutt_addresslist_first(&env->reply_to))) + else if (!TAILQ_EMPTY(&env->reply_to) && !mutt_is_mail_list(TAILQ_FIRST(&env->reply_to))) { pfx = "Reply-To"; al = &env->reply_to; @@ -360,8 +358,9 @@ struct AddressList *mutt_get_address(struct Envelope *env, const char **pfxp) */ void mutt_alias_create(struct Envelope *cur, struct AddressList *al) { + struct Address *addr = NULL; struct Alias *new = NULL; - char buf[1024], tmp[1024], prompt[128]; + char buf[1024], tmp[1024] = { 0 }, prompt[128]; char *pc = NULL; char *err = NULL; char fixed[1024]; @@ -371,16 +370,17 @@ void mutt_alias_create(struct Envelope *cur, struct AddressList *al) al = mutt_get_address(cur, NULL); } - struct Address *addr = mutt_addresslist_first(al); - if (addr && addr->mailbox) + if (al) { - mutt_str_strfcpy(tmp, addr->mailbox, sizeof(tmp)); - pc = strchr(tmp, '@'); - if (pc) - *pc = '\0'; + addr = TAILQ_FIRST(al); + if (addr && addr->mailbox) + { + mutt_str_strfcpy(tmp, addr->mailbox, sizeof(tmp)); + pc = strchr(tmp, '@'); + if (pc) + *pc = '\0'; + } } - else - tmp[0] = '\0'; /* Don't suggest a bad alias name in the event of a strange local part. */ check_alias_name(tmp, buf, sizeof(buf)); @@ -451,7 +451,7 @@ retry_name: mutt_alias_free(&new); return; } - mutt_str_replace(&TAILQ_FIRST(&new->addr)->addr->personal, buf); + mutt_str_replace(&TAILQ_FIRST(&new->addr)->personal, buf); buf[0] = '\0'; mutt_addresslist_write(buf, sizeof(buf), &new->addr, true); @@ -546,11 +546,11 @@ void mutt_alias_add_reverse(struct Alias *t) * by all callers, but added here mostly as documentation. */ mutt_addresslist_to_intl(&t->addr, NULL); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &t->addr, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, &t->addr, entries) { - if (!an->addr->group && an->addr->mailbox) - mutt_hash_insert(ReverseAliases, an->addr->mailbox, an->addr); + if (!a->group && a->mailbox) + mutt_hash_insert(ReverseAliases, a->mailbox, a); } } @@ -567,11 +567,11 @@ void mutt_alias_delete_reverse(struct Alias *t) * match the hash entries. */ mutt_addresslist_to_intl(&t->addr, NULL); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &t->addr, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, &t->addr, entries) { - if (!an->addr->group && an->addr->mailbox) - mutt_hash_delete(ReverseAliases, an->addr->mailbox, an->addr); + if (!a->group && a->mailbox) + mutt_hash_delete(ReverseAliases, a->mailbox, a); } } diff --git a/commands.c b/commands.c index 1a857237b..62dfa0ad8 100644 --- a/commands.c +++ b/commands.c @@ -216,7 +216,7 @@ int mutt_display_message(struct Email *cur) if (cur->security & APPLICATION_PGP) { if (!TAILQ_EMPTY(&cur->env->from)) - crypt_pgp_invoke_getkeys(mutt_addresslist_first(&cur->env->from)); + crypt_pgp_invoke_getkeys(TAILQ_FIRST(&cur->env->from)); crypt_invoke_message(APPLICATION_PGP); } diff --git a/config/address.c b/config/address.c index 08a207891..f60f4a7e0 100644 --- a/config/address.c +++ b/config/address.c @@ -70,7 +70,7 @@ static int address_string_set(const struct ConfigSet *cs, void *var, struct Conf // TODO - config can only store one struct AddressList al = TAILQ_HEAD_INITIALIZER(al); mutt_addresslist_parse(&al, value); - addr = mutt_addr_copy(mutt_addresslist_first(&al)); + addr = mutt_addr_copy(TAILQ_FIRST(&al)); mutt_addresslist_free_all(&al); } diff --git a/copy.c b/copy.c index 5c8aa7599..591a363ed 100644 --- a/copy.c +++ b/copy.c @@ -961,31 +961,30 @@ static void format_address_header(char **h, struct AddressList *al) buflen = linelen + 3; mutt_mem_realloc(h, buflen); - struct AddressNode *first = TAILQ_FIRST(al); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *first = TAILQ_FIRST(al); + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { *buf = '\0'; *cbuf = '\0'; *c2buf = '\0'; - const size_t l = mutt_addr_write(buf, sizeof(buf), an->addr, false); + const size_t l = mutt_addr_write(buf, sizeof(buf), a, false); - if (an != first && (linelen + l > 74)) + if (a != first && (linelen + l > 74)) { strcpy(cbuf, "\n\t"); linelen = l + 8; } else { - if (an->addr->mailbox) + if (a->mailbox) { strcpy(cbuf, " "); linelen++; } linelen += l; } - if (!an->addr->group && TAILQ_NEXT(an, entries) && - TAILQ_NEXT(an, entries)->addr->mailbox) + if (!a->group && TAILQ_NEXT(a, entries) && TAILQ_NEXT(a, entries)->mailbox) { linelen++; buflen++; @@ -1083,12 +1082,12 @@ static int address_header_decode(char **h) mutt_addresslist_to_local(&al); rfc2047_decode_addrlist(&al); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, &al, entries) { - if (an->addr->personal) + if (a->personal) { - mutt_str_dequote_comment(an->addr->personal); + mutt_str_dequote_comment(a->personal); } } diff --git a/email/envelope.c b/email/envelope.c index c18aa7820..4af7775f3 100644 --- a/email/envelope.c +++ b/email/envelope.c @@ -129,7 +129,7 @@ void mutt_env_merge(struct Envelope *base, struct Envelope **extra) #define MOVE_ADDRESSLIST(member) \ if (TAILQ_EMPTY(&base->member)) \ { \ - TAILQ_SWAP(&base->member, &((*extra))->member, AddressNode, entries); \ + TAILQ_SWAP(&base->member, &((*extra))->member, Address, entries); \ } MOVE_ADDRESSLIST(return_path); diff --git a/email/parse.c b/email/parse.c index 4c1a0423c..03d34f5d4 100644 --- a/email/parse.c +++ b/email/parse.c @@ -73,7 +73,7 @@ void mutt_auto_subscribe(const char *mailto) if ((mutt_parse_mailto(lpenv, NULL, mailto) != -1) && !TAILQ_EMPTY(&lpenv->to)) { - const char *mailbox = TAILQ_FIRST(&lpenv->to)->addr->mailbox; + const char *mailbox = TAILQ_FIRST(&lpenv->to)->mailbox; if (mailbox && !mutt_regexlist_match(&UnSubscribedLists, mailbox) && !mutt_regexlist_match(&UnMailLists, mailbox) && !mutt_regexlist_match(&UnSubscribedLists, mailbox)) diff --git a/email/rfc2047.c b/email/rfc2047.c index f98905bcc..3482374e8 100644 --- a/email/rfc2047.c +++ b/email/rfc2047.c @@ -751,13 +751,13 @@ void rfc2047_encode_addrlist(struct AddressList *al, const char *tag) return; int col = tag ? strlen(tag) + 2 : 32; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (an->addr->personal) - rfc2047_encode(&an->addr->personal, AddressSpecials, col, C_SendCharset); - else if (an->addr->group && an->addr->mailbox) - rfc2047_encode(&an->addr->mailbox, AddressSpecials, col, C_SendCharset); + if (a->personal) + rfc2047_encode(&a->personal, AddressSpecials, col, C_SendCharset); + else if (a->group && a->mailbox) + rfc2047_encode(&a->mailbox, AddressSpecials, col, C_SendCharset); } } @@ -770,15 +770,15 @@ void rfc2047_decode_addrlist(struct AddressList *al) if (!al) return; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (an->addr->personal && ((strstr(an->addr->personal, "=?")) || C_AssumedCharset)) + if (a->personal && ((strstr(a->personal, "=?")) || C_AssumedCharset)) { - rfc2047_decode(&an->addr->personal); + rfc2047_decode(&a->personal); } - else if (an->addr->group && an->addr->mailbox && strstr(an->addr->mailbox, "=?")) - rfc2047_decode(&an->addr->mailbox); + else if (a->group && a->mailbox && strstr(a->mailbox, "=?")) + rfc2047_decode(&a->mailbox); } } diff --git a/hcache/serialize.c b/hcache/serialize.c index e8005bf0b..0a5798448 100644 --- a/hcache/serialize.c +++ b/hcache/serialize.c @@ -208,12 +208,12 @@ unsigned char *serial_dump_address(struct AddressList *al, unsigned char *d, d = serial_dump_int(0xdeadbeef, d, off); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - d = serial_dump_char(an->addr->personal, d, off, convert); - d = serial_dump_char(an->addr->mailbox, d, off, false); - d = serial_dump_int(an->addr->group, d, off); + d = serial_dump_char(a->personal, d, off, convert); + d = serial_dump_char(a->mailbox, d, off, false); + d = serial_dump_int(a->group, d, off); counter++; } @@ -244,7 +244,7 @@ void serial_restore_address(struct AddressList *al, const unsigned char *d, serial_restore_char(&a->mailbox, d, off, false); serial_restore_int(&g, d, off); a->group = !!g; - mutt_addresslist_append(al, a); + TAILQ_INSERT_TAIL(al, a, entries); counter--; } } diff --git a/hdrline.c b/hdrline.c index b231a1c25..8d3d1c893 100644 --- a/hdrline.c +++ b/hdrline.c @@ -135,13 +135,13 @@ bool mutt_is_subscribed_list(const struct Address *addr) static bool check_for_mailing_list(struct AddressList *al, const char *pfx, char *buf, int buflen) { - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (mutt_is_subscribed_list(an->addr)) + if (mutt_is_subscribed_list(a)) { if (pfx && buf && buflen) - snprintf(buf, buflen, "%s%s", pfx, mutt_get_name(an->addr)); + snprintf(buf, buflen, "%s%s", pfx, mutt_get_name(a)); return true; } } @@ -159,13 +159,13 @@ static bool check_for_mailing_list(struct AddressList *al, const char *pfx, */ static bool check_for_mailing_list_addr(struct AddressList *al, char *buf, int buflen) { - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (mutt_is_subscribed_list(an->addr)) + if (mutt_is_subscribed_list(a)) { if (buf && buflen) - snprintf(buf, buflen, "%s", an->addr->mailbox); + snprintf(buf, buflen, "%s", a->mailbox); return true; } } @@ -181,12 +181,12 @@ static bool check_for_mailing_list_addr(struct AddressList *al, char *buf, int b */ static bool first_mailing_list(char *buf, size_t buflen, struct AddressList *al) { - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (mutt_is_subscribed_list(an->addr)) + if (mutt_is_subscribed_list(a)) { - mutt_save_path(buf, buflen, an->addr); + mutt_save_path(buf, buflen, a); return true; } } @@ -318,7 +318,7 @@ static void make_from(struct Envelope *env, char *buf, size_t buflen, enum FieldType disp; struct AddressList *name = NULL; - me = mutt_addr_is_user(mutt_addresslist_first(&env->from)); + me = mutt_addr_is_user(TAILQ_FIRST(&env->from)); if (do_lists || me) { @@ -354,8 +354,7 @@ static void make_from(struct Envelope *env, char *buf, size_t buflen, return; } - snprintf(buf, buflen, "%s%s", make_from_prefix(disp), - mutt_get_name(mutt_addresslist_first(name))); + snprintf(buf, buflen, "%s%s", make_from_prefix(disp), mutt_get_name(TAILQ_FIRST(name))); } /** @@ -370,7 +369,7 @@ static void make_from_addr(struct Envelope *env, char *buf, size_t buflen, bool if (!env || !buf) return; - bool me = mutt_addr_is_user(mutt_addresslist_first(&env->from)); + bool me = mutt_addr_is_user(TAILQ_FIRST(&env->from)); if (do_lists || me) { @@ -381,11 +380,11 @@ static void make_from_addr(struct Envelope *env, char *buf, size_t buflen, bool } if (me && !TAILQ_EMPTY(&env->to)) - snprintf(buf, buflen, "%s", mutt_addresslist_first(&env->to)->mailbox); + snprintf(buf, buflen, "%s", TAILQ_FIRST(&env->to)->mailbox); else if (me && !TAILQ_EMPTY(&env->cc)) - snprintf(buf, buflen, "%s", mutt_addresslist_first(&env->cc)->mailbox); + snprintf(buf, buflen, "%s", TAILQ_FIRST(&env->cc)->mailbox); else if (!TAILQ_EMPTY(&env->from)) - mutt_str_strfcpy(buf, mutt_addresslist_first(&env->from)->mailbox, buflen); + mutt_str_strfcpy(buf, TAILQ_FIRST(&env->from)->mailbox, buflen); else *buf = '\0'; } @@ -397,9 +396,9 @@ static void make_from_addr(struct Envelope *env, char *buf, size_t buflen, bool */ static bool user_in_addr(struct AddressList *al) { - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) - if (mutt_addr_is_user(an->addr)) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) + if (mutt_addr_is_user(a)) return true; return false; } @@ -426,7 +425,7 @@ static int user_is_recipient(struct Email *e) { e->recip_valid = true; - if (mutt_addr_is_user(mutt_addresslist_first(&env->from))) + if (mutt_addr_is_user(TAILQ_FIRST(&env->from))) e->recipient = 4; else if (user_in_addr(&env->to)) { @@ -570,10 +569,10 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co struct Context *ctx = hfi->ctx; struct Mailbox *m = hfi->mailbox; - const struct Address *reply_to = mutt_addresslist_first(&e->env->reply_to); - const struct Address *from = mutt_addresslist_first(&e->env->from); - const struct Address *to = mutt_addresslist_first(&e->env->to); - const struct Address *cc = mutt_addresslist_first(&e->env->cc); + const struct Address *reply_to = TAILQ_FIRST(&e->env->reply_to); + const struct Address *from = TAILQ_FIRST(&e->env->from); + const struct Address *to = TAILQ_FIRST(&e->env->to); + const struct Address *cc = TAILQ_FIRST(&e->env->cc); if (!e || !e->env) return src; diff --git a/hook.c b/hook.c index fb24a00eb..62c8f8036 100644 --- a/hook.c +++ b/hook.c @@ -665,10 +665,10 @@ void mutt_default_save(char *path, size_t pathlen, struct Email *e) return; struct Envelope *env = e->env; - const struct Address *from = mutt_addresslist_first(&env->from); - const struct Address *reply_to = mutt_addresslist_first(&env->reply_to); - const struct Address *to = mutt_addresslist_first(&env->to); - const struct Address *cc = mutt_addresslist_first(&env->cc); + const struct Address *from = TAILQ_FIRST(&env->from); + const struct Address *reply_to = TAILQ_FIRST(&env->reply_to); + const struct Address *to = TAILQ_FIRST(&env->to); + const struct Address *cc = TAILQ_FIRST(&env->cc); const struct Address *addr = NULL; bool from_me = mutt_addr_is_user(from); @@ -700,9 +700,9 @@ void mutt_select_fcc(char *path, size_t pathlen, struct Email *e) { if (addr_hook(path, pathlen, MUTT_FCC_HOOK, NULL, e) != 0) { - const struct Address *to = mutt_addresslist_first(&e->env->to); - const struct Address *cc = mutt_addresslist_first(&e->env->cc); - const struct Address *bcc = mutt_addresslist_first(&e->env->bcc); + const struct Address *to = TAILQ_FIRST(&e->env->to); + const struct Address *cc = TAILQ_FIRST(&e->env->cc); + const struct Address *bcc = TAILQ_FIRST(&e->env->bcc); if ((C_SaveName || C_ForceName) && (to || cc || bcc)) { const struct Address *addr = to ? to : (cc ? cc : bcc); diff --git a/init.c b/init.c index 35a63a58a..4e0a5ccbd 100644 --- a/init.c +++ b/init.c @@ -946,16 +946,16 @@ static enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s, if (C_DebugLevel > LL_DEBUG4) { /* A group is terminated with an empty address, so check a->mailbox */ - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &tmp->addr, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, &tmp->addr, entries) { - if (!an->addr->mailbox) + if (!a->mailbox) break; - if (an->addr->group) - mutt_debug(5, " Group %s\n", an->addr->mailbox); + if (a->group) + mutt_debug(5, " Group %s\n", a->mailbox); else - mutt_debug(5, " %s\n", an->addr->mailbox); + mutt_debug(5, " %s\n", a->mailbox); } } mutt_grouplist_destroy(&gc); diff --git a/mx.c b/mx.c index 79b7e6e00..e7ce022f8 100644 --- a/mx.c +++ b/mx.c @@ -981,11 +981,11 @@ struct Message *mx_msg_open_new(struct Mailbox *m, struct Email *e, MsgOpenFlags { if (e) { - p = mutt_addresslist_first(&e->env->return_path); + p = TAILQ_FIRST(&e->env->return_path); if (!p) - p = mutt_addresslist_first(&e->env->sender); + p = TAILQ_FIRST(&e->env->sender); if (!p) - p = mutt_addresslist_first(&e->env->from); + p = TAILQ_FIRST(&e->env->from); } fprintf(msg->fp, "From %s %s", p ? p->mailbox : NONULL(Username), diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index f0ade30fa..6ea3edc54 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -245,7 +245,7 @@ int mutt_protect(struct Email *msg, char *keylist) { /* Set sender (necessary for e.g. PKA). */ const char *mailbox = NULL; - struct Address *from = mutt_addresslist_first(&msg->env->from); + struct Address *from = TAILQ_FIRST(&msg->env->from); bool free_from = false; if (!from) diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 51d0596e6..f66a4e4a1 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -4918,10 +4918,10 @@ static struct CryptKeyInfo *crypt_getkeybyaddr(struct Address *a, struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist); mutt_addresslist_parse(&alist, k->uid); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &alist, entries) + struct Address *ka = NULL; + TAILQ_FOREACH(ka, &alist, entries) { - int validity = crypt_id_matches_addr(a, an->addr, k); + int validity = crypt_id_matches_addr(a, ka, k); if (validity & CRYPT_KV_MATCH) /* something matches */ { @@ -5153,15 +5153,15 @@ static char *find_keys(struct AddressList *addrlist, unsigned int app, bool oppe bool key_selected; struct AddressList hookal = TAILQ_HEAD_INITIALIZER(hookal); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, addrlist, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, addrlist, entries) { key_selected = false; - mutt_crypt_hook(&crypt_hook_list, an->addr); + mutt_crypt_hook(&crypt_hook_list, a); crypt_hook = STAILQ_FIRST(&crypt_hook_list); do { - p = an->addr; + p = a; forced_valid = 0; k_info = NULL; @@ -5188,7 +5188,7 @@ static char *find_keys(struct AddressList *addrlist, unsigned int app, bool oppe if (strchr(keyID, '@') && (mutt_addresslist_parse(&hookal, keyID) != 0)) { mutt_addresslist_qualify(&hookal, fqdn); - p = mutt_addresslist_first(&hookal); + p = TAILQ_FIRST(&hookal); } else if (!oppenc_mode) { @@ -5585,12 +5585,12 @@ static bool verify_sender(struct Email *e) if (!TAILQ_EMPTY(&e->env->from)) { mutt_expand_aliases(&e->env->from); - sender = mutt_addresslist_first(&e->env->from); + sender = TAILQ_FIRST(&e->env->from); } else if (!TAILQ_EMPTY(&e->env->sender)) { mutt_expand_aliases(&e->env->sender); - sender = mutt_addresslist_first(&e->env->sender); + sender = TAILQ_FIRST(&e->env->sender); } if (sender) diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index b70ba733f..148772657 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -1422,15 +1422,15 @@ char *pgp_class_find_keys(struct AddressList *addrlist, bool oppenc_mode) bool key_selected; struct AddressList hookal = TAILQ_HEAD_INITIALIZER(hookal); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, addrlist, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, addrlist, entries) { key_selected = false; - mutt_crypt_hook(&crypt_hook_list, an->addr); + mutt_crypt_hook(&crypt_hook_list, a); crypt_hook = STAILQ_FIRST(&crypt_hook_list); do { - p = an->addr; + p = a; k_info = NULL; if (crypt_hook) @@ -1456,7 +1456,7 @@ char *pgp_class_find_keys(struct AddressList *addrlist, bool oppenc_mode) if (strchr(keyID, '@') && (mutt_addresslist_parse(&hookal, keyID) != 0)) { mutt_addresslist_qualify(&hookal, fqdn); - p = mutt_addresslist_first(&hookal); + p = TAILQ_FIRST(&hookal); } else if (!oppenc_mode) { diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 7cb68361c..7790e1f6b 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -444,9 +444,8 @@ void pgp_class_invoke_getkeys(struct Address *addr) *tmp = '\0'; struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist); - mutt_addresslist_append(&alist, addr); + TAILQ_INSERT_TAIL(&alist, addr, entries); mutt_addresslist_to_local(&alist); - mutt_addresslist_clear(&alist); mutt_addr_write(tmp, sizeof(tmp), addr, false); mutt_buffer_quote_filename(buf, tmp, true); diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 18daa42b6..4d4e94114 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -1035,10 +1035,10 @@ struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, KeyFlags abilities, { struct AddressList al = TAILQ_HEAD_INITIALIZER(al); mutt_addresslist_parse(&al, NONULL(q->addr)); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &al, entries) + struct Address *qa = NULL; + TAILQ_FOREACH(qa, &al, entries) { - int validity = pgp_id_matches_addr(a, an->addr, q); + int validity = pgp_id_matches_addr(a, qa, q); if (validity & PGP_KV_MATCH) /* something matches */ match = true; diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 6b45fc225..37f90fd5d 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -1005,21 +1005,21 @@ void smime_class_getkeys(struct Envelope *env) return; } - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &env->to, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, &env->to, entries) { - if (mutt_addr_is_user(an->addr)) + if (mutt_addr_is_user(a)) { - getkeys(an->addr->mailbox); + getkeys(a->mailbox); return; } } - TAILQ_FOREACH(an, &env->cc, entries) + TAILQ_FOREACH(a, &env->cc, entries) { - if (mutt_addr_is_user(an->addr)) + if (mutt_addr_is_user(a)) { - getkeys(an->addr->mailbox); + getkeys(a->mailbox); return; } } @@ -1039,20 +1039,20 @@ char *smime_class_find_keys(struct AddressList *al, bool oppenc_mode) size_t keylist_size = 0; size_t keylist_used = 0; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - key = smime_get_key_by_addr(an->addr->mailbox, KEYFLAG_CANENCRYPT, true, !oppenc_mode); + key = smime_get_key_by_addr(a->mailbox, KEYFLAG_CANENCRYPT, true, !oppenc_mode); if (!key && !oppenc_mode) { char buf[1024]; - snprintf(buf, sizeof(buf), _("Enter keyID for %s: "), an->addr->mailbox); + snprintf(buf, sizeof(buf), _("Enter keyID for %s: "), a->mailbox); key = smime_ask_for_key(buf, KEYFLAG_CANENCRYPT, true); } if (!key) { if (!oppenc_mode) - mutt_message(_("No (valid) certificate found for %s"), an->addr->mailbox); + mutt_message(_("No (valid) certificate found for %s"), a->mailbox); FREE(&keylist); return NULL; } @@ -1442,12 +1442,12 @@ int smime_class_verify_sender(struct Email *e) if (!TAILQ_EMPTY(&e->env->from)) { mutt_expand_aliases(&e->env->from); - mbox = mutt_addresslist_first(&e->env->from)->mailbox; + mbox = TAILQ_FIRST(&e->env->from)->mailbox; } else if (!TAILQ_EMPTY(&e->env->sender)) { mutt_expand_aliases(&e->env->sender); - mbox = mutt_addresslist_first(&e->env->sender)->mailbox; + mbox = TAILQ_FIRST(&e->env->sender)->mailbox; } if (mbox) diff --git a/pattern.c b/pattern.c index beaec4128..9f7ffac9a 100644 --- a/pattern.c +++ b/pattern.c @@ -1694,10 +1694,9 @@ static int match_addrlist(struct Pattern *pat, bool match_personal, int n, ...) for (; n; n--) { struct AddressList *al = va_arg(ap, struct AddressList *); - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - struct Address *a = an->addr; if (pat->alladdr ^ ((!pat->isalias || mutt_alias_reverse_lookup(a)) && ((a->mailbox && patmatch(pat, a->mailbox)) || (match_personal && a->personal && patmatch(pat, a->personal))))) @@ -1751,10 +1750,10 @@ static int mutt_is_predicate_recipient(bool alladdr, struct Envelope *e, addr_pr for (size_t i = 0; i < mutt_array_size(als); ++i) { struct AddressList *al = als[i]; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (alladdr ^ p(an->addr)) + if (alladdr ^ p(a)) return !alladdr; } } @@ -1795,21 +1794,21 @@ int mutt_is_list_recipient(bool alladdr, struct Envelope *e) */ static int match_user(int alladdr, struct AddressList *al1, struct AddressList *al2) { - struct AddressNode *an = NULL; + struct Address *a = NULL; if (al1) { - TAILQ_FOREACH(an, al1, entries) + TAILQ_FOREACH(a, al1, entries) { - if (alladdr ^ mutt_addr_is_user(an->addr)) + if (alladdr ^ mutt_addr_is_user(a)) return !alladdr; } } if (al2) { - TAILQ_FOREACH(an, al2, entries) + TAILQ_FOREACH(a, al2, entries) { - if (alladdr ^ mutt_addr_is_user(an->addr)) + if (alladdr ^ mutt_addr_is_user(a)) return !alladdr; } } diff --git a/query.c b/query.c index bb631e886..0c27554a8 100644 --- a/query.c +++ b/query.c @@ -97,10 +97,10 @@ static struct AddressList *result_to_addr(struct Query *r) mutt_addresslist_copy(al, &r->addr, false); if (!TAILQ_EMPTY(al)) { - struct AddressNode *first = TAILQ_FIRST(al); - struct AddressNode *second = TAILQ_NEXT(first, entries); - if (!second && !first->addr->personal) - first->addr->personal = mutt_str_strdup(r->name); + struct Address *first = TAILQ_FIRST(al); + struct Address *second = TAILQ_NEXT(first, entries); + if (!second && !first->personal) + first->personal = mutt_str_strdup(r->name); mutt_addresslist_to_intl(al, NULL); } @@ -238,7 +238,7 @@ static int query_search(struct Menu *menu, regex_t *rx, int line) return 0; if (!TAILQ_EMPTY(&query->addr)) { - struct Address *addr = mutt_addresslist_first(&query->addr); + struct Address *addr = TAILQ_FIRST(&query->addr); if (addr->personal && !regexec(rx, addr->personal, 0, NULL, 0)) { return 0; diff --git a/remailer.c b/remailer.c index ae71972f8..40f804e1b 100644 --- a/remailer.c +++ b/remailer.c @@ -788,10 +788,10 @@ int mix_check_message(struct Email *msg) * use_domain won't be respected at this point, hidden_host will. */ - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, &msg->env->to, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, &msg->env->to, entries) { - if (!an->addr->group && !strchr(an->addr->mailbox, '@')) + if (!a->group && !strchr(a->mailbox, '@')) { need_hostname = true; break; diff --git a/send.c b/send.c index 0b563941f..08a15a7fe 100644 --- a/send.c +++ b/send.c @@ -158,12 +158,12 @@ static void append_signature(FILE *fp) */ static void remove_user(struct AddressList *al, bool leave_only) { - struct AddressNode *an, *tmp; - TAILQ_FOREACH_SAFE(an, al, entries, tmp) + struct Address *a, *tmp; + TAILQ_FOREACH_SAFE(a, al, entries, tmp) { - if (mutt_addr_is_user(an->addr) && (!leave_only || TAILQ_NEXT(an, entries))) + if (mutt_addr_is_user(a) && (!leave_only || TAILQ_NEXT(a, entries))) { - mutt_addresslist_free_one(al, an); + mutt_addresslist_free_one(al, a); } } } @@ -181,12 +181,12 @@ static void add_mailing_lists(struct AddressList *out, const struct AddressList for (const struct AddressList *al = *als; al; ++al) { - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (!an->addr->group && mutt_is_mail_list(an->addr)) + if (!a->group && mutt_is_mail_list(a)) { - mutt_addresslist_append(out, an->addr); + TAILQ_INSERT_TAIL(out, a, entries); } } } @@ -711,8 +711,8 @@ static int include_reply(struct Mailbox *m, struct Email *e, FILE *fp_out) static int default_to(struct AddressList *to, struct Envelope *env, SendFlags flags, int hmfupto) { char prompt[256]; - const struct Address *from = mutt_addresslist_first(&env->from); - const struct Address *reply_to = mutt_addresslist_first(&env->reply_to); + const struct Address *from = TAILQ_FIRST(&env->from); + const struct Address *reply_to = TAILQ_FIRST(&env->reply_to); if (flags && !TAILQ_EMPTY(&env->mail_followup_to) && (hmfupto == MUTT_YES)) { @@ -792,7 +792,7 @@ static int default_to(struct AddressList *to, struct Envelope *env, SendFlags fl int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, SendFlags flags) { enum QuadOption hmfupto = MUTT_ABORT; - const struct Address *followup_to = mutt_addresslist_first(&in->mail_followup_to); + const struct Address *followup_to = TAILQ_FIRST(&in->mail_followup_to); if ((flags & (SEND_LIST_REPLY | SEND_GROUP_REPLY | SEND_GROUP_CHAT_REPLY)) && followup_to) { @@ -889,7 +889,7 @@ void mutt_fix_reply_recipients(struct Envelope *env) if (!TAILQ_EMPTY(&env->cc) && TAILQ_EMPTY(&env->to)) { - TAILQ_SWAP(&env->to, &env->cc, AddressNode, entries); + TAILQ_SWAP(&env->to, &env->cc, Address, entries); } } @@ -946,8 +946,7 @@ void mutt_add_to_reference_headers(struct Envelope *env, struct Envelope *curenv #ifdef USE_NNTP if (OptNewsSend && C_XCommentTo && !TAILQ_EMPTY(&curenv->from)) - env->x_comment_to = - mutt_str_strdup(mutt_get_name(mutt_addresslist_first(&curenv->from))); + env->x_comment_to = mutt_str_strdup(mutt_get_name(TAILQ_FIRST(&curenv->from))); #endif } @@ -1221,15 +1220,15 @@ void mutt_set_followup_to(struct Envelope *env) if (al) { - struct AddressNode *an = NULL; - TAILQ_FOREACH_REVERSE(an, al, AddressList, entries) + struct Address *a = NULL; + TAILQ_FOREACH_REVERSE(a, al, AddressList, entries) { - mutt_addresslist_prepend(&env->mail_followup_to, an->addr); + TAILQ_INSERT_HEAD(&env->mail_followup_to, mutt_addr_copy(a), entries); } } else { - mutt_addresslist_prepend(&env->mail_followup_to, mutt_default_from()); + TAILQ_INSERT_HEAD(&env->mail_followup_to, mutt_default_from(), entries); } } @@ -1248,14 +1247,14 @@ void mutt_set_followup_to(struct Envelope *env) */ static void set_reverse_name(struct AddressList *al, struct Envelope *env) { - struct AddressNode *an = NULL; + struct Address *a = NULL; if (TAILQ_EMPTY(al)) { - TAILQ_FOREACH(an, &env->to, entries) + TAILQ_FOREACH(a, &env->to, entries) { - if (mutt_addr_is_user(an->addr)) + if (mutt_addr_is_user(a)) { - mutt_addresslist_append(al, an->addr); + TAILQ_INSERT_TAIL(al, mutt_addr_copy(a), entries); break; } } @@ -1263,11 +1262,11 @@ static void set_reverse_name(struct AddressList *al, struct Envelope *env) if (TAILQ_EMPTY(al)) { - TAILQ_FOREACH(an, &env->cc, entries) + TAILQ_FOREACH(a, &env->cc, entries) { - if (mutt_addr_is_user(an->addr)) + if (mutt_addr_is_user(a)) { - mutt_addresslist_append(al, an->addr); + TAILQ_INSERT_TAIL(al, mutt_addr_copy(a), entries); break; } } @@ -1275,10 +1274,10 @@ static void set_reverse_name(struct AddressList *al, struct Envelope *env) if (TAILQ_EMPTY(al)) { - struct Address *from = mutt_addresslist_first(&env->from); + struct Address *from = TAILQ_FIRST(&env->from); if (from && mutt_addr_is_user(from)) { - mutt_addresslist_append(al, from); + TAILQ_INSERT_TAIL(al, mutt_addr_copy(from), entries); } } @@ -1287,7 +1286,7 @@ static void set_reverse_name(struct AddressList *al, struct Envelope *env) /* when $reverse_realname is not set, clear the personal name so that it * may be set via a reply- or send-hook. */ if (!C_ReverseRealname) - FREE(&mutt_addresslist_first(al)->personal); + FREE(&TAILQ_FIRST(al)->personal); } } @@ -1830,7 +1829,6 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, FILE *fp_tmp = NULL; struct Body *pbody = NULL; int i; - bool killfrom = false; bool free_clear_content = false; struct Body *clear_content = NULL; @@ -1992,7 +1990,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (!TAILQ_EMPTY(&msg->env->from)) { mutt_debug(5, "msg->env->from before set_reverse_name: %s\n", - mutt_addresslist_first(&msg->env->from)->mailbox); + TAILQ_FIRST(&msg->env->from)->mailbox); mutt_addresslist_free_all(&msg->env->from); } set_reverse_name(&msg->env->from, cur->env); @@ -2011,7 +2009,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, { mutt_addresslist_copy(&msg->env->from, &cur->env->x_original_to, false); mutt_debug(5, "msg->env->from extracted from X-Original-To: header: %s\n", - mutt_addresslist_first(&msg->env->from)->mailbox); + TAILQ_FIRST(&msg->env->from)->mailbox); } } @@ -2054,10 +2052,10 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, * patterns will work. if $use_from is unset, the from address is killed * after send-hooks are evaluated */ - if (TAILQ_EMPTY(&msg->env->from)) + const bool killfrom = TAILQ_EMPTY(&msg->env->from); + if (killfrom) { - mutt_addresslist_append(&msg->env->from, mutt_default_from()); - killfrom = true; + TAILQ_INSERT_TAIL(&msg->env->from, mutt_default_from(), entries); } if ((flags & SEND_REPLY) && cur) @@ -2095,8 +2093,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, { mutt_addresslist_free_all(&msg->env->from); if (C_UseFrom && !(flags & (SEND_POSTPONED | SEND_RESEND))) - mutt_addresslist_append(&msg->env->from, mutt_default_from()); - killfrom = false; + TAILQ_INSERT_TAIL(&msg->env->from, mutt_default_from(), entries); } if (C_Hdrs) @@ -2133,7 +2130,7 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, /* wait until now to set the real name portion of our return address so * that $realname can be set in a send-hook */ { - struct Address *from = mutt_addresslist_first(&msg->env->from); + struct Address *from = TAILQ_FIRST(&msg->env->from); if (from && !from->personal && !(flags & (SEND_RESEND | SEND_POSTPONED))) from->personal = mutt_str_strdup(C_Realname); } @@ -2332,11 +2329,10 @@ int ci_send_message(SendFlags flags, struct Email *msg, const char *tempfile, if (!fcc[0] && !(flags & SEND_POSTPONED_FCC) && (!(flags & SEND_BATCH) || (C_Copy & 0x1))) { /* set the default FCC */ - if (TAILQ_EMPTY(&msg->env->from)) + const bool killfrom = TAILQ_EMPTY(&msg->env->from); + if (killfrom) { - mutt_addresslist_append(&msg->env->from, mutt_default_from()); - killfrom = true; /* no need to check $use_from because if the user specified - a from address it would have already been set by now */ + TAILQ_INSERT_TAIL(&msg->env->from, mutt_default_from(), entries); } mutt_select_fcc(fcc, sizeof(fcc), msg); if (killfrom) diff --git a/sendlib.c b/sendlib.c index e5b75beac..c7308facd 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1758,12 +1758,11 @@ void mutt_write_addresslist(struct AddressList *al, FILE *fp, int linelen, bool char buf[1024]; int count = 0; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - struct Address *addr = an->addr; buf[0] = '\0'; - mutt_addr_write(buf, sizeof(buf), addr, display); + mutt_addr_write(buf, sizeof(buf), a, display); size_t len = mutt_str_strlen(buf); if (count && (linelen + len > 74)) { @@ -1772,7 +1771,7 @@ void mutt_write_addresslist(struct AddressList *al, FILE *fp, int linelen, bool } else { - if (count && addr->mailbox) + if (count && a->mailbox) { fputc(' ', fp); linelen++; @@ -1780,8 +1779,8 @@ void mutt_write_addresslist(struct AddressList *al, FILE *fp, int linelen, bool linelen += len; } fputs(buf, fp); - struct AddressNode *next = TAILQ_NEXT(an, entries); - if (!addr->group && next && next->addr->mailbox) + struct Address *next = TAILQ_NEXT(a, entries); + if (!a->group && next && next->mailbox) { linelen++; fputc(',', fp); @@ -2700,10 +2699,10 @@ static char **add_args_one(char **args, size_t *argslen, size_t *argsmax, struct */ static char **add_args(char **args, size_t *argslen, size_t *argsmax, struct AddressList *al) { - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - args = add_args_one(args, argslen, argsmax, an->addr); + args = add_args_one(args, argslen, argsmax, a); } return args; } @@ -2925,9 +2924,9 @@ void mutt_prepare_envelope(struct Envelope *env, bool final) * recipients if there is no To: or Cc: field, so attempt to suppress * it by using an empty To: field. */ struct Address *to = mutt_addr_new(); - mutt_addresslist_append(&env->to, to); - mutt_addresslist_append(&env->to, mutt_addr_new()); to->group = 1; + TAILQ_INSERT_TAIL(&env->to, to, entries); + TAILQ_INSERT_TAIL(&env->to, mutt_addr_new(), entries); char buf[1024]; buf[0] = '\0'; @@ -3046,7 +3045,7 @@ int mutt_bounce_message(FILE *fp, struct Email *e, struct AddressList *to) resent_from[0] = '\0'; struct Address *from = mutt_default_from(); struct AddressList from_list = TAILQ_HEAD_INITIALIZER(from_list); - mutt_addresslist_append(&from_list, from); + TAILQ_INSERT_TAIL(&from_list, from, entries); /* mutt_default_from() does not use $realname if the real name is not set * in $from, so we add it here. The reason it is not added in diff --git a/smtp.c b/smtp.c index 321a5672b..936687717 100644 --- a/smtp.c +++ b/smtp.c @@ -173,18 +173,18 @@ static int smtp_rcpt_to(struct Connection *conn, const struct AddressList *al) char buf[1024]; int rc; - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { /* weed out group mailboxes, since those are for display only */ - if (!an->addr->mailbox || an->addr->group) + if (!a->mailbox || a->group) { continue; } if ((Capabilities & SMTP_CAP_DSN) && C_DsnNotify) - snprintf(buf, sizeof(buf), "RCPT TO:<%s> NOTIFY=%s\r\n", an->addr->mailbox, C_DsnNotify); + snprintf(buf, sizeof(buf), "RCPT TO:<%s> NOTIFY=%s\r\n", a->mailbox, C_DsnNotify); else - snprintf(buf, sizeof(buf), "RCPT TO:<%s>\r\n", an->addr->mailbox); + snprintf(buf, sizeof(buf), "RCPT TO:<%s>\r\n", a->mailbox); if (mutt_socket_send(conn, buf) == -1) return SMTP_ERR_WRITE; rc = smtp_get_resp(conn); @@ -300,10 +300,10 @@ static bool address_uses_unicode(const char *a) */ static bool addresses_use_unicode(const struct AddressList *al) { - struct AddressNode *an = NULL; - TAILQ_FOREACH(an, al, entries) + struct Address *a = NULL; + TAILQ_FOREACH(a, al, entries) { - if (an->addr->mailbox && !an->addr->group && address_uses_unicode(an->addr->mailbox)) + if (a->mailbox && !a->group && address_uses_unicode(a->mailbox)) return true; } return false; @@ -750,8 +750,8 @@ int mutt_smtp_send(const struct AddressList *from, const struct AddressList *to, * but this condition is most likely arrived at accidentally */ if (C_EnvelopeFromAddress) envfrom = C_EnvelopeFromAddress->mailbox; - else if (!TAILQ_EMPTY(from)) - envfrom = mutt_addresslist_first(from)->mailbox; + else if (from && !TAILQ_EMPTY(from)) + envfrom = TAILQ_FIRST(from)->mailbox; else { mutt_error(_("No from address given")); diff --git a/sort.c b/sort.c index 9948709cb..f64d2f82e 100644 --- a/sort.c +++ b/sort.c @@ -177,8 +177,8 @@ static int compare_to(const void *a, const void *b) struct Email **ppb = (struct Email **) b; char fa[128]; - mutt_str_strfcpy(fa, mutt_get_name(mutt_addresslist_first(&(*ppa)->env->to)), sizeof(fa)); - const char *fb = mutt_get_name(mutt_addresslist_first(&(*ppb)->env->to)); + mutt_str_strfcpy(fa, mutt_get_name(TAILQ_FIRST(&(*ppa)->env->to)), sizeof(fa)); + const char *fb = mutt_get_name(TAILQ_FIRST(&(*ppb)->env->to)); int result = mutt_str_strncasecmp(fa, fb, sizeof(fa)); result = perform_auxsort(result, a, b); return SORT_CODE(result); @@ -193,9 +193,8 @@ static int compare_from(const void *a, const void *b) struct Email **ppb = (struct Email **) b; char fa[128]; - mutt_str_strfcpy(fa, mutt_get_name(mutt_addresslist_first(&(*ppa)->env->from)), - sizeof(fa)); - const char *fb = mutt_get_name(mutt_addresslist_first(&(*ppb)->env->from)); + mutt_str_strfcpy(fa, mutt_get_name(TAILQ_FIRST(&(*ppa)->env->from)), sizeof(fa)); + const char *fb = mutt_get_name(TAILQ_FIRST(&(*ppb)->env->from)); int result = mutt_str_strncasecmp(fa, fb, sizeof(fa)); result = perform_auxsort(result, a, b); return SORT_CODE(result); diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index fa85e1547..a5cd79503 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -1,5 +1,4 @@ -ADDRESS_OBJS = test/address/mutt_addr_append.o \ - test/address/mutt_addr_cat.o \ +ADDRESS_OBJS = test/address/mutt_addr_cat.o \ test/address/mutt_addr_cmp.o \ test/address/mutt_addr_copy.o \ test/address/mutt_addr_copy_list.o \ diff --git a/test/address/mutt_addr_append.c b/test/address/mutt_addr_append.c deleted file mode 100644 index 72bbb854f..000000000 --- a/test/address/mutt_addr_append.c +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file - * Test code for mutt_addr_append() - * - * @authors - * Copyright (C) 2019 Richard Russon - * - * @copyright - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 2 of the License, or (at your option) any later - * version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#define TEST_NO_MAIN -#include "acutest.h" -#include "config.h" -#include "mutt/mutt.h" -#include "address/lib.h" - -void test_mutt_addr_append(void) -{ - { - struct Address addr = { 0 }; - mutt_addresslist_append(NULL, &addr); - TEST_CHECK(true); // no crash - } - - { - struct AddressList al = TAILQ_HEAD_INITIALIZER(al); - mutt_addresslist_append(&al, NULL); - TEST_CHECK(true); // no crash - } -} diff --git a/test/address/mutt_addresslist_parse.c b/test/address/mutt_addresslist_parse.c index dc8f08105..0e20786d1 100644 --- a/test/address/mutt_addresslist_parse.c +++ b/test/address/mutt_addresslist_parse.c @@ -33,13 +33,13 @@ void test_mutt_addresslist_parse(void) { struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist); mutt_addresslist_parse(&alist, "apple"); - TEST_CHECK(mutt_addresslist_first(&alist) != NULL); + TEST_CHECK(TAILQ_FIRST(&alist) != NULL); mutt_addresslist_free_all(&alist); } { struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist); mutt_addresslist_parse(&alist, NULL); - TEST_CHECK(mutt_addresslist_first(&alist) == NULL); + TEST_CHECK(TAILQ_FIRST(&alist) == NULL); } } diff --git a/test/address/mutt_addresslist_parse2.c b/test/address/mutt_addresslist_parse2.c index 735f99d16..f5b995b0c 100644 --- a/test/address/mutt_addresslist_parse2.c +++ b/test/address/mutt_addresslist_parse2.c @@ -32,14 +32,14 @@ void test_mutt_addresslist_parse2(void) { struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist); mutt_addresslist_parse(&alist, "apple"); - TEST_CHECK(mutt_addresslist_first(&alist) != NULL); + TEST_CHECK(TAILQ_FIRST(&alist) != NULL); mutt_addresslist_free_all(&alist); } { struct AddressList alist = TAILQ_HEAD_INITIALIZER(alist); mutt_addresslist_parse(&alist, NULL); - TEST_CHECK(mutt_addresslist_first(&alist) == NULL); + TEST_CHECK(TAILQ_FIRST(&alist) == NULL); } mutt_buffer_pool_free(); diff --git a/test/main.c b/test/main.c index f458bf4f5..04d671791 100644 --- a/test/main.c +++ b/test/main.c @@ -26,7 +26,6 @@ * Add your test cases to this list. *****************************************************************************/ #define NEOMUTT_TEST_LIST \ - NEOMUTT_TEST_ITEM(test_mutt_addr_append) \ NEOMUTT_TEST_ITEM(test_mutt_addr_cat) \ NEOMUTT_TEST_ITEM(test_mutt_addr_cmp) \ NEOMUTT_TEST_ITEM(test_mutt_addr_copy) \ -- 2.40.0