]> granicus.if.org Git - mutt/commitdiff
Remove useless assignments in add_to_list functions.
authorKevin McCarthy <kevin@8t8.us>
Mon, 22 Jan 2018 03:41:47 +0000 (19:41 -0800)
committerKevin McCarthy <kevin@8t8.us>
Mon, 22 Jan 2018 03:41:47 +0000 (19:41 -0800)
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.

init.c

diff --git a/init.c b/init.c
index 1a86182cd616f5c6934bc04854ad38a583b892f3..535f371a5aac8f29a235a29d46849fc5b2893ba3 100644 (file)
--- 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);