X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=thread.c;h=c5cc040853cc234d3bc82e1b1cdf21ad9354788d;hp=ed690f25888d2d31f206e48360148305147eaf39;hb=cc92b181f21c2a68b321e596dc9302c3db8f33c7;hpb=108f3c7ab59844591f7540347914ea57be5245e2 diff --git a/thread.c b/thread.c index ed690f2..c5cc040 100644 --- a/thread.c +++ b/thread.c @@ -7,21 +7,12 @@ * please see the file GPL in the top level source directory. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include +#include #include "mutt.h" #include "sort.h" #include "thread.h" - -#include -#include - #define VISIBLE(hdr, ctx) (hdr->virtual >= 0 || (hdr->collapsed && (!ctx->pattern || hdr->limited))) /* determine whether a is a descendant of b */ @@ -204,10 +195,6 @@ static void calculate_visibility (CONTEXT * ctx, int *max_depth) /* Since the graphics characters have a value >255, I have to resort to * using escape sequences to pass the information to print_enriched_string(). * These are the macros M_TREE_* defined in mutt.h. - * - * ncurses should automatically use the default ASCII characters instead of - * graphics chars on terminals which don't support them (see the man page - * for curs_addch). */ void mutt_draw_tree (CONTEXT * ctx) { @@ -511,7 +498,7 @@ void mutt_clear_threads (CONTEXT * ctx) ctx->tree = NULL; if (ctx->thread_hash) - hash_destroy (&ctx->thread_hash, free); + hash_delete (&ctx->thread_hash, free); } static int compare_threads (const void *a, const void *b) @@ -698,7 +685,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) init = 1; if (init) - ctx->thread_hash = hash_create (ctx->msgcount * 2); + ctx->thread_hash = hash_new (ctx->msgcount * 2, 1); /* we want a quick way to see if things are actually attached to the top of the * thread tree or if they're just dangling, so we attach everything to a top @@ -763,7 +750,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) cur->thread = thread; hash_insert (ctx->thread_hash, cur->env->message_id ? cur->env->message_id : "", - thread, 1); + thread); if (new) { if (new->duplicate_thread) @@ -839,7 +826,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) if ((new = hash_find (ctx->thread_hash, ref->data)) == NULL) { new = p_new(THREAD, 1); - hash_insert (ctx->thread_hash, ref->data, new, 1); + hash_insert (ctx->thread_hash, ref->data, new); } else { if (new->duplicate_thread) @@ -1199,41 +1186,41 @@ int mutt_messages_in_thread (CONTEXT * ctx, HEADER * hdr, int flag) } -HASH *mutt_make_id_hash (CONTEXT * ctx) +hash_t *mutt_make_id_hash (CONTEXT * ctx) { int i; HEADER *hdr; - HASH *hash; + hash_t *hash; - hash = hash_create (ctx->msgcount * 2); + hash = hash_new (ctx->msgcount * 2, 0); for (i = 0; i < ctx->msgcount; i++) { hdr = ctx->hdrs[i]; if (hdr->env->message_id) - hash_insert (hash, hdr->env->message_id, hdr, 0); + hash_insert (hash, hdr->env->message_id, hdr); } return hash; } -HASH *mutt_make_subj_hash (CONTEXT * ctx) +hash_t *mutt_make_subj_hash (CONTEXT * ctx) { int i; HEADER *hdr; - HASH *hash; + hash_t *hash; - hash = hash_create (ctx->msgcount * 2); + hash = hash_new (ctx->msgcount * 2, 1); for (i = 0; i < ctx->msgcount; i++) { hdr = ctx->hdrs[i]; if (hdr->env->real_subj) - hash_insert (hash, hdr->env->real_subj, hdr, 1); + hash_insert(hash, hdr->env->real_subj, hdr); } return hash; } -static void clean_references (THREAD * brk, THREAD * cur) +static void clean_references (THREAD * tbrk, THREAD * cur) { THREAD *p; string_list_t *ref = NULL; @@ -1241,7 +1228,7 @@ static void clean_references (THREAD * brk, THREAD * cur) for (; cur; cur = cur->next, done = 0) { /* parse subthread recursively */ - clean_references (brk, cur->child); + clean_references (tbrk, cur->child); if (!cur->message) break; /* skip pseudo-message */ @@ -1249,7 +1236,7 @@ static void clean_references (THREAD * brk, THREAD * cur) /* Looking for the first bad reference according to the new threading. * Optimal since Mutt stores the references in reverse order, and the * first loop should match immediatly for mails respecting RFC2822. */ - for (p = brk; !done && p; p = p->parent) + for (p = tbrk; !done && p; p = p->parent) for (ref = cur->message->env->references; p->message && ref; ref = ref->next) if (!m_strcasecmp(ref->data, p->message->env->message_id)) {