From: Kevin McCarthy Date: Mon, 22 Jan 2018 03:41:47 +0000 (-0800) Subject: Remove useless assignments in add_to_list functions. X-Git-Tag: mutt-1-10-rel~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ee1f84d6ef5ce8f870883997e59b36274cf9747;p=mutt Remove useless assignments in add_to_list functions. The code was probably pulled from some of the header processing functions, which were in a loop. In those versions, "last" pointed to a collection of new entries appended, but in these two functions, updating last just obfuscates the code. --- diff --git a/init.c b/init.c index 1a86182c..535f371a 100644 --- a/init.c +++ b/init.c @@ -399,12 +399,9 @@ static void add_to_list (LIST **list, const char *str) t = (LIST *) safe_calloc (1, sizeof (LIST)); t->data = safe_strdup (str); if (last) - { last->next = t; - last = last->next; - } else - *list = last = t; + *list = t; } } @@ -440,12 +437,9 @@ int mutt_add_to_rx_list (RX_LIST **list, const char *s, int flags, BUFFER *err) t = mutt_new_rx_list(); t->rx = rx; if (last) - { last->next = t; - last = last->next; - } else - *list = last = t; + *list = t; } else /* duplicate */ mutt_free_regexp (&rx);