mem_calloc -> p_new
[apps/madmutt.git] / smime.c
diff --git a/smime.c b/smime.c
index cba7100..728d111 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -13,6 +13,8 @@
 # include "config.h"
 #endif
 
+#include <lib-lib/mem.h>
+
 #include "mutt.h"
 #include "enter.h"
 #include "handler.h"
@@ -389,7 +391,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
     }
     /* Read Entries */
     cur = 0;
-    Table = mem_calloc (cert_num, sizeof (smime_id));
+    Table = p_new(smime_id, cert_num);
     while (!feof (index)) {
       numFields =
         fscanf (index, MUTT_FORMAT (STRING) " %x.%i " MUTT_FORMAT (STRING),
@@ -455,14 +457,14 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
       }
     }
     if (hash) {
-      fname = mem_malloc (13); /* Hash + '.' + Suffix + \0 */
+      fname = p_new(char, 13); /* Hash + '.' + Suffix + \0 */
       sprintf (fname, "%.8x.%i", Table[cur].hash, Table[cur].suffix);
     }
     else
       fname = NULL;
 
     mutt_menuDestroy (&menu);
-    mem_free (&Table);
+    p_delete(&Table);
     set_option (OPTNEEDREDRAW);
 
     if (fname)
@@ -649,7 +651,7 @@ void _smime_getkeys (char *mailbox)
     /* the key used last time. */
     if (*SmimeKeyToUse &&
         !str_casecmp (k, SmimeKeyToUse + str_len (SmimeKeys) + 1)) {
-      mem_free (&k);
+      p_delete(&k);
       return;
     }
     else
@@ -664,7 +666,7 @@ void _smime_getkeys (char *mailbox)
     if (str_casecmp (k, SmimeDefaultKey))
       smime_void_passphrase ();
 
-    mem_free (&k);
+    p_delete(&k);
     return;
   }
 
@@ -766,7 +768,7 @@ char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
     }
     if (!keyID) {
       mutt_message (_("No (valid) certificate found for %s."), q->mailbox);
-      mem_free (&keylist);
+      p_delete(&keylist);
       rfc822_free_address (&tmp);
       rfc822_free_address (&addr);
       return NULL;
@@ -854,14 +856,13 @@ static int smime_handle_cert_email (char *certificate, char *mailbox,
 
   if (copy && buffer && num) {
     (*num) = count;
-    *buffer = mem_calloc (sizeof (char *), count);
+    *buffer = p_new(char *, count);
     count = 0;
 
     rewind (fpout);
     while ((fgets (email, sizeof (email), fpout))) {
       *(email + str_len (email) - 1) = '\0';
-      (*buffer)[count] = mem_calloc (1, str_len (email) + 1);
-      strncpy ((*buffer)[count], email, str_len (email));
+      (*buffer)[count] = p_dupstr(email, str_len(email));
       count++;
     }
   }
@@ -1091,7 +1092,7 @@ void smime_invoke_import (char *infile, char *mailbox)
     mutt_wait_filter (thepid);
 
     mutt_unlink (certfile);
-    mem_free (&certfile);
+    p_delete(&certfile);
   }
 
   fflush (fpout);
@@ -1150,7 +1151,7 @@ int smime_verify_sender (HEADER * h)
       else
         retval = 0;
       mutt_unlink (certfile);
-      mem_free (&certfile);
+      p_delete(&certfile);
     }
     else
       mutt_any_key_to_continue (_("no certfile"));
@@ -1567,7 +1568,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
       if (linelen && !str_casecmp (line, "verification successful"))
         badsig = 0;
 
-      mem_free (&line);
+      p_delete(&line);
     }
   }
 
@@ -1780,7 +1781,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
     line = mutt_read_line (line, &linelen, smimeerr, &lineno);
     if (linelen && !str_casecmp (line, "verification successful"))
       m->goodsig = 1;
-    mem_free (&line);
+    p_delete(&line);
   }
   else {
     m->goodsig = p->goodsig;
@@ -1935,7 +1936,7 @@ int smime_send_menu (HEADER * msg, int *redraw)
             break;
 
           case 4: /* (c)lear */
-            mem_free (&SmimeCryptAlg);
+            p_delete(&SmimeCryptAlg);
             /* fallback */
           case -1: /* Ctrl-G or Enter */
             choice = 0;