projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rocco Rutte:
[apps/madmutt.git]
/
thread.c
diff --git
a/thread.c
b/thread.c
index
0b20076
..
0f93794
100644
(file)
--- a/
thread.c
+++ b/
thread.c
@@
-13,6
+13,7
@@
#include "mutt.h"
#include "sort.h"
#include "mutt.h"
#include "sort.h"
+#include "thread.h"
#include "lib/mem.h"
#include "lib/intl.h"
#include "lib/mem.h"
#include "lib/intl.h"
@@
-128,7
+129,7
@@
static void calculate_visibility (CONTEXT * ctx, int *max_depth)
tree->subtree_visible = 0;
if (tree->message) {
tree->subtree_visible = 0;
if (tree->message) {
-
FREE
(&tree->message->tree);
+
mem_free
(&tree->message->tree);
if (VISIBLE (tree->message, ctx)) {
tree->deep = 1;
tree->visible = 1;
if (VISIBLE (tree->message, ctx)) {
tree->deep = 1;
tree->visible = 1;
@@
-220,8
+221,8
@@
void mutt_draw_tree (CONTEXT * ctx)
* From now on we can simply ignore invisible subtrees
*/
calculate_visibility (ctx, &max_depth);
* From now on we can simply ignore invisible subtrees
*/
calculate_visibility (ctx, &max_depth);
- pfx =
safe
_malloc (width * max_depth + 2);
- arrow =
safe
_malloc (width * max_depth + 2);
+ pfx =
mem
_malloc (width * max_depth + 2);
+ arrow =
mem
_malloc (width * max_depth + 2);
while (tree) {
if (depth) {
myarrow = arrow + (depth - start_depth - (start_depth ? 0 : 1)) * width;
while (tree) {
if (depth) {
myarrow = arrow + (depth - start_depth - (start_depth ? 0 : 1)) * width;
@@
-239,7
+240,7
@@
void mutt_draw_tree (CONTEXT * ctx)
if (tree->visible) {
myarrow[width] = M_TREE_RARROW;
myarrow[width + 1] = 0;
if (tree->visible) {
myarrow[width] = M_TREE_RARROW;
myarrow[width + 1] = 0;
- new_tree =
safe
_malloc ((2 + depth * width));
+ new_tree =
mem
_malloc ((2 + depth * width));
if (start_depth > 1) {
strncpy (new_tree, pfx, (start_depth - 1) * width);
strfcpy (new_tree + (start_depth - 1) * width,
if (start_depth > 1) {
strncpy (new_tree, pfx, (start_depth - 1) * width);
strfcpy (new_tree + (start_depth - 1) * width,
@@
-306,8
+307,8
@@
void mutt_draw_tree (CONTEXT * ctx)
while (!tree->deep);
}
while (!tree->deep);
}
-
FREE
(&pfx);
-
FREE
(&arrow);
+
mem_free
(&pfx);
+
mem_free
(&arrow);
}
/* since we may be trying to attach as a pseudo-thread a THREAD that
}
/* since we may be trying to attach as a pseudo-thread a THREAD that
@@
-338,12
+339,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) {
((env->real_subj != env->subject) || (!option (OPTSORTRE)))) {
for (curlist = subjects, oldlist = NULL;
curlist; oldlist = curlist, curlist = curlist->next) {
- rc =
mutt_str
cmp (env->real_subj, curlist->data);
+ rc =
str_
cmp (env->real_subj, curlist->data);
if (rc >= 0)
break;
}
if (!curlist || rc > 0) {
if (rc >= 0)
break;
}
if (!curlist || rc > 0) {
- newlist =
safe
_calloc (1, sizeof (LIST));
+ newlist =
mem
_calloc (1, sizeof (LIST));
newlist->data = env->real_subj;
if (oldlist) {
newlist->next = oldlist->next;
newlist->data = env->real_subj;
if (oldlist) {
newlist->next = oldlist->next;
@@
-398,13
+399,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 &&
(last->message->received < tmp->message->received) :
(last->message->date_sent < tmp->message->date_sent))) &&
tmp->message->env->real_subj &&
-
mutt_str
cmp (subjects->data, tmp->message->env->real_subj) == 0)
+
str_
cmp (subjects->data, tmp->message->env->real_subj) == 0)
last = tmp; /* best match so far */
}
oldlist = subjects;
subjects = subjects->next;
last = tmp; /* best match so far */
}
oldlist = subjects;
subjects = subjects->next;
-
FREE
(&oldlist);
+
mem_free
(&oldlist);
}
return (last);
}
}
return (last);
}
@@
-471,7
+472,7
@@
static void pseudo_threads (CONTEXT * ctx)
* parent, since otherwise they rightly belong to the message
* we're attaching. */
if (tmp == cur
* parent, since otherwise they rightly belong to the message
* we're attaching. */
if (tmp == cur
- || !
mutt_str
cmp (tmp->message->env->real_subj,
+ || !
str_
cmp (tmp->message->env->real_subj,
parent->message->env->real_subj)) {
tmp->message->subject_changed = 0;
parent->message->env->real_subj)) {
tmp->message->subject_changed = 0;
@@
-512,7
+513,7
@@
void mutt_clear_threads (CONTEXT * ctx)
hash_destroy (&ctx->thread_hash, free);
}
hash_destroy (&ctx->thread_hash, free);
}
-int compare_threads (const void *a, const void *b)
+
static
int compare_threads (const void *a, const void *b)
{
static sort_t *sort_func = NULL;
{
static sort_t *sort_func = NULL;
@@
-546,7
+547,7
@@
THREAD *mutt_sort_subthreads (THREAD * thread, int init)
top = thread;
top = thread;
- array =
safe
_calloc ((array_size = 256), sizeof (THREAD *));
+ array =
mem
_calloc ((array_size = 256), sizeof (THREAD *));
while (1) {
if (init || !thread->sort_key) {
thread->sort_key = NULL;
while (1) {
if (init || !thread->sort_key) {
thread->sort_key = NULL;
@@
-578,7
+579,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)
/* put them into the array */
for (i = 0; thread; i++, thread = thread->prev) {
if (i >= array_size)
-
safe
_realloc (&array, (array_size *= 2) * sizeof (THREAD *));
+
mem
_realloc (&array, (array_size *= 2) * sizeof (THREAD *));
array[i] = thread;
}
array[i] = thread;
}
@@
-638,7
+639,7
@@
THREAD *mutt_sort_subthreads (THREAD * thread, int init)
}
else {
Sort ^= SORT_REVERSE;
}
else {
Sort ^= SORT_REVERSE;
-
FREE
(&array);
+
mem_free
(&array);
return (top);
}
}
return (top);
}
}
@@
-669,7
+670,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)
if (!tmp)
cur->subject_changed = 1;
else if (cur->env->real_subj && tmp->message->env->real_subj)
- cur->subject_changed =
mutt_str
cmp (cur->env->real_subj,
+ cur->subject_changed =
str_
cmp (cur->env->real_subj,
tmp->message->env->
real_subj) ? 1 : 0;
else
tmp->message->env->
real_subj) ? 1 : 0;
else
@@
-755,7
+756,7
@@
void mutt_sort_threads (CONTEXT * ctx, int init)
else {
new = (option (OPTDUPTHREADS) ? thread : NULL);
else {
new = (option (OPTDUPTHREADS) ? thread : NULL);
- thread =
safe
_calloc (1, sizeof (THREAD));
+ thread =
mem
_calloc (1, sizeof (THREAD));
thread->message = cur;
thread->check_subject = 1;
cur->thread = thread;
thread->message = cur;
thread->check_subject = 1;
cur->thread = thread;
@@
-821,7
+822,7
@@
void mutt_sort_threads (CONTEXT * ctx, int init)
if (!cur->env->references)
ref = ref->next;
else {
if (!cur->env->references)
ref = ref->next;
else {
- if (
mutt_str
cmp (ref->data, cur->env->references->data))
+ if (
str_
cmp (ref->data, cur->env->references->data))
ref = cur->env->references;
else
ref = cur->env->references->next;
ref = cur->env->references;
else
ref = cur->env->references->next;
@@
-836,7
+837,7
@@
void mutt_sort_threads (CONTEXT * ctx, int init)
break;
if ((new = hash_find (ctx->thread_hash, ref->data)) == NULL) {
break;
if ((new = hash_find (ctx->thread_hash, ref->data)) == NULL) {
- new =
safe
_calloc (1, sizeof (THREAD));
+ new =
mem
_calloc (1, sizeof (THREAD));
hash_insert (ctx->thread_hash, ref->data, new, 1);
}
else {
hash_insert (ctx->thread_hash, ref->data, new, 1);
}
else {
@@
-1250,7
+1251,7
@@
static void clean_references (THREAD * brk, THREAD * cur)
for (p = brk; !done && p; p = p->parent)
for (ref = cur->message->env->references; p->message && ref;
ref = ref->next)
for (p = brk; !done && p; p = p->parent)
for (ref = cur->message->env->references; p->message && ref;
ref = ref->next)
- if (!s
afe_str
casecmp (ref->data, p->message->env->message_id)) {
+ if (!s
tr_
casecmp (ref->data, p->message->env->message_id)) {
done = 1;
break;
}
done = 1;
break;
}
@@
-1261,14
+1262,7
@@
static void clean_references (THREAD * brk, THREAD * cur)
/* clearing the References: header from obsolete Message-Id(s) */
mutt_free_list (&ref->next);
/* clearing the References: header from obsolete Message-Id(s) */
mutt_free_list (&ref->next);
- if (h->new_env)
- mutt_free_list (&h->new_env->references);
- else
- h->new_env = mutt_new_envelope ();
-
- h->new_env->references = mutt_copy_list (h->env->references);
-
- h->refs_changed = h->changed = 1;
+ h->env->refs_changed = h->changed = 1;
}
}
}
}
}
}
@@
-1277,15
+1271,7
@@
void mutt_break_thread (HEADER * hdr)
{
mutt_free_list (&hdr->env->in_reply_to);
mutt_free_list (&hdr->env->references);
{
mutt_free_list (&hdr->env->in_reply_to);
mutt_free_list (&hdr->env->references);
- hdr->irt_changed = hdr->refs_changed = hdr->changed = 1;
-
- if (hdr->new_env) {
- mutt_free_list (&hdr->new_env->in_reply_to);
- mutt_free_list (&hdr->new_env->references);
- }
- else
- hdr->new_env = mutt_new_envelope ();
-
+ hdr->env->irt_changed = hdr->env->refs_changed = 1;
clean_references (hdr->thread, hdr->thread->child);
}
clean_references (hdr->thread, hdr->thread->child);
}
@@
-1297,14
+1283,11
@@
static int link_threads (HEADER * parent, HEADER * child, CONTEXT * ctx)
mutt_break_thread (child);
child->env->in_reply_to = mutt_new_list ();
mutt_break_thread (child);
child->env->in_reply_to = mutt_new_list ();
- child->env->in_reply_to->data = safe_strdup (parent->env->message_id);
-
- child->new_env->in_reply_to = mutt_new_list ();
- child->new_env->in_reply_to->data = safe_strdup (parent->env->message_id);
+ child->env->in_reply_to->data = str_dup (parent->env->message_id);
mutt_set_flag (ctx, child, M_TAG, 0);
mutt_set_flag (ctx, child, M_TAG, 0);
- child->irt_changed = child->changed = 1;
+ child->
env->
irt_changed = child->changed = 1;
return 1;
}
return 1;
}