drop mem_alloc and mem_free, use my own hand crafted optmized macros that
[apps/madmutt.git] / thread.c
index 2aa421d..57b1bcb 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -11,6 +11,8 @@
 # include "config.h"
 #endif
 
+#include <lib-lib/mem.h>
+
 #include "mutt.h"
 #include "sort.h"
 #include "thread.h"
@@ -129,7 +131,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 +223,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 +242,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 +309,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
@@ -405,7 +407,7 @@ static THREAD *find_subject (CONTEXT * ctx, THREAD * cur)
 
     oldlist = subjects;
     subjects = subjects->next;
-    mem_free (&oldlist);
+    p_delete(&oldlist);
   }
   return (last);
 }
@@ -639,7 +641,7 @@ THREAD *mutt_sort_subthreads (THREAD * thread, int init)
       }
       else {
         Sort ^= SORT_REVERSE;
-        mem_free (&array);
+        p_delete(&array);
         return (top);
       }
     }