drop mem_alloc and mem_free, use my own hand crafted optmized macros that
[apps/madmutt.git] / mutt_idna.c
index 78fe7be..1ad3b62 100644 (file)
@@ -11,6 +11,8 @@
 # include "config.h"
 #endif
 
+#include <lib-lib/mem.h>
+
 #include "mutt.h"
 #include "ascii.h"
 #include "charset.h"
@@ -74,8 +76,8 @@ int mutt_idna_to_local (const char *in, char **out, int flags)
       irrev = 1;
     }
 
-    mem_free (&t2);
-    mem_free (&tmp);
+    p_delete(&t2);
+    p_delete(&tmp);
 
     if (irrev)
       goto notrans;
@@ -84,7 +86,7 @@ int mutt_idna_to_local (const char *in, char **out, int flags)
   return 0;
 
 notrans:
-  mem_free (out);
+  p_delete(out);
   *out = str_dup (in);
   return 1;
 }
@@ -106,9 +108,9 @@ int mutt_local_to_idna (const char *in, char **out)
   if (!rv && idna_to_ascii_8z (tmp, out, 1) != IDNA_SUCCESS)
     rv = -2;
 
-  mem_free (&tmp);
+  p_delete(&tmp);
   if (rv < 0) {
-    mem_free (out);
+    p_delete(out);
     *out = str_dup (in);
   }
   return rv;
@@ -160,9 +162,9 @@ int mutt_addrlist_to_idna (ADDRESS * a, char **err)
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
-    mem_free (&domain);
-    mem_free (&user);
-    mem_free (&tmp);
+    p_delete(&domain);
+    p_delete(&user);
+    p_delete(&tmp);
 
     if (e)
       return -1;
@@ -187,9 +189,9 @@ int mutt_addrlist_to_local (ADDRESS * a)
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
-    mem_free (&domain);
-    mem_free (&user);
-    mem_free (&tmp);
+    p_delete(&domain);
+    p_delete(&user);
+    p_delete(&tmp);
   }
 
   return 0;
@@ -206,22 +208,22 @@ const char *mutt_addr_for_display (ADDRESS * a)
   char *domain = NULL;
   char *user = NULL;
 
-  mem_free (&buff);
+  p_delete(&buff);
 
   if (mbox_to_udomain (a->mailbox, &user, &domain) != 0)
     return a->mailbox;
   if (mutt_idna_to_local (domain, &tmp, MI_MAY_BE_IRREVERSIBLE) != 0) {
-    mem_free (&user);
-    mem_free (&domain);
-    mem_free (&tmp);
+    p_delete(&user);
+    p_delete(&domain);
+    p_delete(&tmp);
     return a->mailbox;
   }
 
   mem_realloc (&buff, str_len (tmp) + str_len (user) + 2);
   sprintf (buff, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
-  mem_free (&tmp);
-  mem_free (&user);
-  mem_free (&domain);
+  p_delete(&tmp);
+  p_delete(&user);
+  p_delete(&domain);
   return buff;
 }
 
@@ -248,7 +250,7 @@ void mutt_env_to_local (ENVELOPE * e)
      if (tag) *tag = #a; e = 1; err = NULL; \
   }
 
-int mutt_env_to_idna (ENVELOPE * env, char **tag, char **err)
+int mutt_env_to_idna (ENVELOPE * env, const char **tag, const char **err)
 {
   int e = 0;