X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=thread.c;h=1bf0b5fd40fa2f020057d1275e1ed94524f6ced7;hp=2aa421d581fd703e50a9165f7626ef14f9d38d22;hb=2ea77d3b2827ba23feb756ce2fb936565ae38998;hpb=4b1dc0d42a3165db9201ba40af9ad041f33333a5 diff --git a/thread.c b/thread.c index 2aa421d..1bf0b5f 100644 --- a/thread.c +++ b/thread.c @@ -11,12 +11,13 @@ # include "config.h" #endif +#include +#include + #include "mutt.h" #include "sort.h" #include "thread.h" -#include "lib/mem.h" -#include "lib/intl.h" #include #include @@ -129,7 +130,7 @@ static void calculate_visibility (CONTEXT * ctx, int *max_depth) tree->subtree_visible = 0; if (tree->message) { - mem_free (&tree->message->tree); + p_delete(&tree->message->tree); if (VISIBLE (tree->message, ctx)) { tree->deep = 1; tree->visible = 1; @@ -221,8 +222,8 @@ void mutt_draw_tree (CONTEXT * ctx) * From now on we can simply ignore invisible subtrees */ calculate_visibility (ctx, &max_depth); - pfx = mem_malloc (width * max_depth + 2); - arrow = mem_malloc (width * max_depth + 2); + pfx = p_new(char, width * max_depth + 2); + arrow = p_new(char, width * max_depth + 2); while (tree) { if (depth) { myarrow = arrow + (depth - start_depth - (start_depth ? 0 : 1)) * width; @@ -240,7 +241,7 @@ void mutt_draw_tree (CONTEXT * ctx) if (tree->visible) { myarrow[width] = M_TREE_RARROW; myarrow[width + 1] = 0; - new_tree = mem_malloc ((2 + depth * width)); + new_tree = p_new(char, (2 + depth * width)); if (start_depth > 1) { strncpy (new_tree, pfx, (start_depth - 1) * width); strfcpy (new_tree + (start_depth - 1) * width, @@ -307,8 +308,8 @@ void mutt_draw_tree (CONTEXT * ctx) while (!tree->deep); } - mem_free (&pfx); - mem_free (&arrow); + p_delete(&pfx); + p_delete(&arrow); } /* since we may be trying to attach as a pseudo-thread a THREAD that @@ -339,12 +340,12 @@ static LIST *make_subject_list (THREAD * cur, time_t * dateptr) ((env->real_subj != env->subject) || (!option (OPTSORTRE)))) { for (curlist = subjects, oldlist = NULL; curlist; oldlist = curlist, curlist = curlist->next) { - rc = str_cmp (env->real_subj, curlist->data); + rc = m_strcmp(env->real_subj, curlist->data); if (rc >= 0) break; } if (!curlist || rc > 0) { - newlist = mem_calloc (1, sizeof (LIST)); + newlist = p_new(LIST, 1); newlist->data = env->real_subj; if (oldlist) { newlist->next = oldlist->next; @@ -399,13 +400,13 @@ static THREAD *find_subject (CONTEXT * ctx, THREAD * cur) (last->message->received < tmp->message->received) : (last->message->date_sent < tmp->message->date_sent))) && tmp->message->env->real_subj && - str_cmp (subjects->data, tmp->message->env->real_subj) == 0) + m_strcmp(subjects->data, tmp->message->env->real_subj) == 0) last = tmp; /* best match so far */ } oldlist = subjects; subjects = subjects->next; - mem_free (&oldlist); + p_delete(&oldlist); } return (last); } @@ -472,7 +473,7 @@ static void pseudo_threads (CONTEXT * ctx) * parent, since otherwise they rightly belong to the message * we're attaching. */ if (tmp == cur - || !str_cmp (tmp->message->env->real_subj, + || !m_strcmp(tmp->message->env->real_subj, parent->message->env->real_subj)) { tmp->message->subject_changed = 0; @@ -547,7 +548,7 @@ THREAD *mutt_sort_subthreads (THREAD * thread, int init) top = thread; - array = mem_calloc ((array_size = 256), sizeof (THREAD *)); + array = p_new(THREAD *, (array_size = 256)); while (1) { if (init || !thread->sort_key) { thread->sort_key = NULL; @@ -579,7 +580,7 @@ THREAD *mutt_sort_subthreads (THREAD * thread, int init) /* put them into the array */ for (i = 0; thread; i++, thread = thread->prev) { if (i >= array_size) - mem_realloc (&array, (array_size *= 2) * sizeof (THREAD *)); + p_realloc(&array, array_size *= 2); array[i] = thread; } @@ -639,7 +640,7 @@ THREAD *mutt_sort_subthreads (THREAD * thread, int init) } else { Sort ^= SORT_REVERSE; - mem_free (&array); + p_delete(&array); return (top); } } @@ -670,7 +671,7 @@ static void check_subjects (CONTEXT * ctx, int init) if (!tmp) cur->subject_changed = 1; else if (cur->env->real_subj && tmp->message->env->real_subj) - cur->subject_changed = str_cmp (cur->env->real_subj, + cur->subject_changed = m_strcmp(cur->env->real_subj, tmp->message->env-> real_subj) ? 1 : 0; else @@ -756,7 +757,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) else { new = (option (OPTDUPTHREADS) ? thread : NULL); - thread = mem_calloc (1, sizeof (THREAD)); + thread = p_new(THREAD, 1); thread->message = cur; thread->check_subject = 1; cur->thread = thread; @@ -822,7 +823,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) if (!cur->env->references) ref = ref->next; else { - if (str_cmp (ref->data, cur->env->references->data)) + if (m_strcmp(ref->data, cur->env->references->data)) ref = cur->env->references; else ref = cur->env->references->next; @@ -837,7 +838,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init) break; if ((new = hash_find (ctx->thread_hash, ref->data)) == NULL) { - new = mem_calloc (1, sizeof (THREAD)); + new = p_new(THREAD, 1); hash_insert (ctx->thread_hash, ref->data, new, 1); } else { @@ -1283,7 +1284,7 @@ static int link_threads (HEADER * parent, HEADER * child, CONTEXT * ctx) mutt_break_thread (child); child->env->in_reply_to = mutt_new_list (); - child->env->in_reply_to->data = str_dup (parent->env->message_id); + child->env->in_reply_to->data = m_strdup(parent->env->message_id); mutt_set_flag (ctx, child, M_TAG, 0);