#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)
/* 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);
{
char buf[LONG_STRING];
NNTP_DATA nntp_data;
- string_list_t *l;
- string_list_t emp;
+ string_list_t *l, **emp;
time_t now;
struct tm *t;
nntp_data.group = ((NNTP_DATA *) Context->data)->group;
else
nntp_data.group = NULL;
- l = serv->tail;
+
+ emp = serv->tail;
if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."), NULL,
add_group, serv, 0) != 0) {
return -1;
mutt_message _("Loading descriptions...");
- if (l)
- emp.next = l->next;
- else
- emp.next = serv->list;
- l = &emp;
- while (l->next) {
- l = l->next;
- ((NNTP_DATA *) l->data)->new = 1;
- nntp_get_desc ((NNTP_DATA *) l->data, ((NNTP_DATA *) l->data)->group,
- NULL, NULL);
+ for (l = *emp; l; l = l->next) {
+ ((NNTP_DATA *)l->data)->new = 1;
+ nntp_get_desc((NNTP_DATA *) l->data, ((NNTP_DATA *)l->data)->group,
+ NULL, NULL);
}
- if (emp.next)
- nntp_save_cache_index (serv);
- mutt_clear_error ();
+ if (*emp)
+ nntp_save_cache_index(serv);
+ mutt_clear_error();
return _checked;
}
time_t check_time;
hash_t *newsgroups;
string_list_t *list; /* list of newsgroups */
- string_list_t *tail; /* last entry of list */
+ string_list_t **tail; /* last entry of list */
CONNECTION *conn;
} NNTP_SERVER;