tail is always a list_item**.
[apps/madmutt.git] / nntp / newsrc.c
index 59ca74f..c919d86 100644 (file)
 #include "sort.h"
 #include "nntp.h"
 
-void nntp_add_to_list (NNTP_SERVER * s, NNTP_DATA * d)
+void nntp_add_to_list(NNTP_SERVER *s, NNTP_DATA *d)
 {
-  string_list_t *l;
-
-  if (!s || !d)
-    return;
-
-  l = p_new(string_list_t, 1);
-  if (s->list)
-    s->tail->next = l;
-  else
-    s->list = l;
-  s->tail = l;
-  l->data = (void *) d;
+    *s->tail = p_new(string_list_t, 1);
+    (*s->tail)->data = (void *)d;
+    s->tail = &(*s->tail)->next;
 }
 
 static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line)
@@ -376,6 +367,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server)
 
   /* New newsserver */
   serv = p_new(NNTP_SERVER, 1);
+  serv->tail = &serv->list;
   serv->conn = conn;
   serv->newsrc = m_strdup(file);
   serv->newsgroups = hash_new(1009, false);