exit mem_realloc, enters p_realloc/xrealloc.
[apps/madmutt.git] / imap / browse.c
index fd9c473..52dcc79 100644 (file)
@@ -17,7 +17,8 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include "lib/mem.h"
+#include <lib-lib/mem.h>
+
 #include "lib/str.h"
 #include "lib/intl.h"
 #include "lib/debug.h"
@@ -231,13 +232,13 @@ int imap_browse (char *path, struct browser_state *state)
   if (save_lsub)
     set_option (OPTIMAPCHECKSUBSCRIBED);
 
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
   return 0;
 
 fail:
   if (save_lsub)
     set_option (OPTIMAPCHECKSUBSCRIBED);
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
   return -1;
 }
 
@@ -284,11 +285,11 @@ int imap_mailbox_create (const char *folder)
 
   mutt_sleep (0);
 
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
   return 0;
 
 fail:
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
   return -1;
 }
 
@@ -329,11 +330,11 @@ int imap_mailbox_rename (const char *mailbox)
   mutt_message (_("Mailbox renamed."));
   mutt_sleep (0);
 
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
   return 0;
 
 fail:
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
   return -1;
 }
 
@@ -356,7 +357,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd,
   do {
     if (imap_parse_list_response (idata, &name, &noselect, &noinferiors,
                                   &idata->delim) != 0) {
-      mem_free (&mx.mbox);
+      p_delete(&mx.mbox);
       return -1;
     }
 
@@ -372,7 +373,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd,
   }
   while ((ascii_strncmp (idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
 
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
   return 0;
 }
 
@@ -392,11 +393,9 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   imap_unmunge_mbox_name (folder);
 
   if (state->entrylen + 1 == state->entrymax) {
-    mem_realloc (&state->entry,
-                  sizeof (struct folder_file) * (state->entrymax += 256));
-    memset (state->entry + state->entrylen, 0,
-            (sizeof (struct folder_file) *
-             (state->entrymax - state->entrylen)));
+    p_realloc(&state->entry, state->entrymax += 256);
+    p_clear(state->entry + state->entrylen,
+            state->entrymax - state->entrylen);
   }
 
   /* render superiors as unix-standard ".." */
@@ -412,7 +411,7 @@ static void imap_add_folder (char delim, char *folder, int noselect,
    * than at scan, since it's so expensive to scan. But that's big changes
    * to browser.c */
   if (!((regexec (Mask.rx, relpath, 0, NULL, 0) == 0) ^ Mask.not)) {
-    mem_free (&mx.mbox);
+    p_delete(&mx.mbox);
     return;
   }
 
@@ -436,7 +435,7 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   (state->entry)[state->entrylen].inferiors = !noinferiors;
   (state->entrylen)++;
 
-  mem_free (&mx.mbox);
+  p_delete(&mx.mbox);
 }
 
 static int compare_names (struct folder_file *a, struct folder_file *b)