drop mem_alloc and mem_free, use my own hand crafted optmized macros that
[apps/madmutt.git] / query.c
diff --git a/query.c b/query.c
index ea5fc89..893d2db 100644 (file)
--- a/query.c
+++ b/query.c
@@ -11,6 +11,8 @@
 # include "config.h"
 #endif
 
+#include <lib-lib/mem.h>
+
 #include "mutt.h"
 #include "mutt_menu.h"
 #include "mutt_idna.h"
@@ -45,7 +47,7 @@ static struct mapping_t QueryHelp[] = {
   {N_("Make Alias"), OP_CREATE_ALIAS},
   {N_("Search"), OP_SEARCH},
   {N_("Help"), OP_HELP},
-  {NULL}
+  {NULL, OP_NULL}
 };
 
 /* Variables for outsizing output format */
@@ -100,11 +102,11 @@ static QUERY *run_query (char *s, int quiet)
       if (first == NULL) {
         FirstColumn = 0;
         SecondColumn = 0;
-        first = (QUERY *) safe_calloc (1, sizeof (QUERY));
+        first = (QUERY *) mem_calloc (1, sizeof (QUERY));
         cur = first;
       }
       else {
-        cur->next = (QUERY *) safe_calloc (1, sizeof (QUERY));
+        cur->next = (QUERY *) mem_calloc (1, sizeof (QUERY));
         cur = cur->next;
       }
 
@@ -126,7 +128,7 @@ static QUERY *run_query (char *s, int quiet)
       }
     }
   }
-  FREE (&buf);
+  p_delete(&buf);
   fclose (fp);
   if (mutt_wait_filter (thepid)) {
     debug_print (1, ("Error: %s\n", msg));
@@ -288,7 +290,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
       menu->max++;
 
     menu->data = QueryTable =
-      (ENTRY *) safe_calloc (menu->max, sizeof (ENTRY));
+      (ENTRY *) mem_calloc (menu->max, sizeof (ENTRY));
 
     for (i = 0, queryp = results; queryp; queryp = queryp->next, i++)
       QueryTable[i].data = queryp;
@@ -310,14 +312,14 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
               queryp = results;
               while (queryp) {
                 rfc822_free_address (&queryp->addr);
-                FREE (&queryp->name);
-                FREE (&queryp->other);
+                p_delete(&queryp->name);
+                p_delete(&queryp->other);
                 results = queryp->next;
-                FREE (&queryp);
+                p_delete(&queryp);
                 queryp = results;
               }
               results = newresults;
-              FREE (&QueryTable);
+              p_delete(&QueryTable);
             }
             else {
               /* append */
@@ -345,7 +347,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
 
             if (op == OP_QUERY) {
               menu->data = QueryTable =
-                (ENTRY *) safe_calloc (menu->max, sizeof (ENTRY));
+                (ENTRY *) mem_calloc (menu->max, sizeof (ENTRY));
 
               for (i = 0, queryp = results; queryp;
                    queryp = queryp->next, i++)
@@ -355,7 +357,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
               int clear = 0;
 
               /* append */
-              safe_realloc (&QueryTable, menu->max * sizeof (ENTRY));
+              mem_realloc (&QueryTable, menu->max * sizeof (ENTRY));
 
               menu->data = QueryTable;
 
@@ -473,13 +475,13 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
     queryp = results;
     while (queryp) {
       rfc822_free_address (&queryp->addr);
-      FREE (&queryp->name);
-      FREE (&queryp->other);
+      p_delete(&queryp->name);
+      p_delete(&queryp->other);
       results = queryp->next;
-      FREE (&queryp);
+      p_delete(&queryp);
       queryp = results;
     }
-    FREE (&QueryTable);
+    p_delete(&QueryTable);
 
     /* tell whoever called me to redraw the screen when I return */
     set_option (OPTNEEDREDRAW);