Add a count field and increment it in add_address() so callers can read
the number of parsed addresses directly from the list struct without
walking the linked list.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Gbp-Pq: Name 0005-lib-mail-Add-count-field-to-struct-message_address_l.patch
i_zero(&ctx->addr);
DLLIST2_APPEND(&ctx->addr_list.head, &ctx->addr_list.tail, addr);
+ ctx->addr_list.count++;
}
/* quote with "" and escape all '\', '"' and "'" characters if need */
struct message_address_list {
struct message_address *head, *tail;
+ unsigned int count;
};
/* Parse message addresses from given data. Note that giving an empty string
validated while MUA only shows the second From header. */
DLLIST2_JOIN(&addr_p->head, &addr_p->tail,
&new_addr.head, &new_addr.tail);
+ addr_p->count += new_addr.count;
} else if (str_p != NULL) {
*str_p = message_header_strdup(pool, hdr->full_value,
hdr->full_value_len);