From: Pierre Habouzit Date: Mon, 28 May 2007 13:10:55 +0000 (+0200) Subject: don't resize the hash, 32k elements are way enough. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=803edc39e2be84e93432e6dc2859a1380c5a9af5;p=apps%2Fmadmutt.git don't resize the hash, 32k elements are way enough. Signed-off-by: Pierre Habouzit --- diff --git a/nntp.c b/nntp.c index d3bf60f..a61bcf8 100644 --- a/nntp.c +++ b/nntp.c @@ -47,8 +47,7 @@ static void mutt_newsgroup_stat(nntp_data_t *data) for (int i = 0; i < data->num; i++) { int first = MAX(data->entries[i].first, data->firstMessage); int last = MIN(data->entries[i].last, data->lastMessage); - if (first <= last) - data->unread -= last - first + 1; + data->unread -= MAX(0, last - first + 1); } } @@ -74,8 +73,6 @@ static int nntp_parse_newsrc_line(nntp_server_t *news, const char *line) data->group = p_dupstr(line, p - line); data->nserv = news; data->deleted = 1; - if (news->newsgroups->nelem < news->newsgroups->curnelem * 2) - hash_resize (news->newsgroups, news->newsgroups->nelem * 2); hash_insert(news->newsgroups, data->group, data); news->tail = nntp_data_list_append(news->tail, data); } else { @@ -202,8 +199,6 @@ static int nntp_parse_cacheindex(nntp_server_t *news) data->group = m_strdup(buf); data->nserv = news; data->deleted = 1; - if (news->newsgroups->nelem < news->newsgroups->curnelem * 2) - hash_resize (news->newsgroups, news->newsgroups->nelem * 2); hash_insert (news->newsgroups, data->group, data); news->tail = nntp_data_list_append(news->tail, data); } @@ -292,8 +287,6 @@ static int add_group (char *buf, void *serv) nntp_data = nntp_data_new(); nntp_data->group = m_strdup(group); nntp_data->nserv = s; - if (s->newsgroups->nelem < s->newsgroups->curnelem * 2) - hash_resize (s->newsgroups, s->newsgroups->nelem * 2); hash_insert(s->newsgroups, nntp_data->group, nntp_data); s->tail = nntp_data_list_append(s->tail, nntp_data); } @@ -909,8 +902,6 @@ nntp_data_t *mutt_newsgroup_subscribe (nntp_server_t * news, char *group) data->group = m_strdup(group); data->nserv = news; data->deleted = 1; - if (news->newsgroups->nelem < news->newsgroups->curnelem * 2) - hash_resize (news->newsgroups, news->newsgroups->nelem * 2); hash_insert (news->newsgroups, data->group, data); news->tail = nntp_data_list_append(news->tail, data); }