Commit 939b02b3 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy
Browse files

Don't allocate a group terminator unless we are in a group-list.

This will reduce memory allocation for garbage/spam address lists.

It also makes no sense to store a terminator when there wasn't a
display-name indicating the start of a group.
parent 59a09320
......@@ -461,7 +461,7 @@ add_addrspec (ADDRESS **top, ADDRESS **last, const char *phrase,
ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s)
{
int ws_pending, nl;
int ws_pending, nl, in_group = 0;
#ifdef EXACT_ADDRESS
const char *begin;
#endif
......@@ -551,6 +551,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s)
terminate_buffer (phrase, phraselen);
cur->mailbox = safe_strdup (phrase);
cur->group = 1;
in_group = 1;
if (last)
last->next = cur;
......@@ -587,11 +588,12 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s)
#endif
/* add group terminator */
if (last)
if (last && in_group)
{
last->next = rfc822_new_address ();
last = last->next;
}
in_group = 0;
phraselen = 0;
commentlen = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment