move intl.h into lib-lib/macros.h
[apps/madmutt.git] / query.c
diff --git a/query.c b/query.c
index df02f4a..f7a7894 100644 (file)
--- a/query.c
+++ b/query.c
 # include "config.h"
 #endif
 
+#include <lib-lib/mem.h>
+#include <lib-lib/macros.h>
+
 #include "mutt.h"
 #include "mutt_menu.h"
 #include "mutt_idna.h"
 #include "mapping.h"
 #include "sort.h"
 
-#include "lib/mem.h"
-#include "lib/intl.h"
 #include "lib/str.h"
 #include "lib/debug.h"
 
@@ -45,7 +46,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 +101,11 @@ static QUERY *run_query (char *s, int quiet)
       if (first == NULL) {
         FirstColumn = 0;
         SecondColumn = 0;
-        first = (QUERY *) mem_calloc (1, sizeof (QUERY));
+        first = p_new(QUERY, 1);
         cur = first;
       }
       else {
-        cur->next = (QUERY *) mem_calloc (1, sizeof (QUERY));
+        cur->next = p_new(QUERY, 1);
         cur = cur->next;
       }
 
@@ -126,7 +127,7 @@ static QUERY *run_query (char *s, int quiet)
       }
     }
   }
-  mem_free (&buf);
+  p_delete(&buf);
   fclose (fp);
   if (mutt_wait_filter (thepid)) {
     debug_print (1, ("Error: %s\n", msg));
@@ -287,8 +288,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
     for (queryp = results; queryp; queryp = queryp->next)
       menu->max++;
 
-    menu->data = QueryTable =
-      (ENTRY *) mem_calloc (menu->max, sizeof (ENTRY));
+    menu->data = QueryTable = p_new(ENTRY, menu->max);
 
     for (i = 0, queryp = results; queryp; queryp = queryp->next, i++)
       QueryTable[i].data = queryp;
@@ -310,14 +310,14 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
               queryp = results;
               while (queryp) {
                 rfc822_free_address (&queryp->addr);
-                mem_free (&queryp->name);
-                mem_free (&queryp->other);
+                p_delete(&queryp->name);
+                p_delete(&queryp->other);
                 results = queryp->next;
-                mem_free (&queryp);
+                p_delete(&queryp);
                 queryp = results;
               }
               results = newresults;
-              mem_free (&QueryTable);
+              p_delete(&QueryTable);
             }
             else {
               /* append */
@@ -344,8 +344,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
               menu->max++;
 
             if (op == OP_QUERY) {
-              menu->data = QueryTable =
-                (ENTRY *) mem_calloc (menu->max, sizeof (ENTRY));
+              menu->data = QueryTable = p_new(ENTRY, menu->max);
 
               for (i = 0, queryp = results; queryp;
                    queryp = queryp->next, i++)
@@ -355,7 +354,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
               int clear = 0;
 
               /* append */
-              mem_realloc (&QueryTable, menu->max * sizeof (ENTRY));
+              p_realloc(&QueryTable, menu->max);
 
               menu->data = QueryTable;
 
@@ -473,13 +472,13 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
     queryp = results;
     while (queryp) {
       rfc822_free_address (&queryp->addr);
-      mem_free (&queryp->name);
-      mem_free (&queryp->other);
+      p_delete(&queryp->name);
+      p_delete(&queryp->other);
       results = queryp->next;
-      mem_free (&queryp);
+      p_delete(&queryp);
       queryp = results;
     }
-    mem_free (&QueryTable);
+    p_delete(&QueryTable);
 
     /* tell whoever called me to redraw the screen when I return */
     set_option (OPTNEEDREDRAW);