move hash.[hc] into lib-lib/
[apps/madmutt.git] / mutt_ssl.c
index 801da78..804183c 100644 (file)
 #include <openssl/err.h>
 #include <openssl/rand.h>
 
-#undef _
-
 #include <string.h>
 
 #include <lib-lib/mem.h>
+#include <lib-lib/str.h>
+#include <lib-lib/macros.h>
 
 #include "mutt.h"
 #include "mutt_socket.h"
@@ -30,9 +30,6 @@
 #include "mutt_curses.h"
 #include "mutt_ssl.h"
 
-#include "lib/mem.h"
-#include "lib/intl.h"
-#include "lib/str.h"
 #include "lib/debug.h"
 
 #if OPENSSL_VERSION_NUMBER >= 0x00904000L
@@ -88,7 +85,7 @@ int mutt_ssl_starttls (CONNECTION * conn)
   if (ssl_init ())
     goto bail;
 
-  ssldata = (sslsockdata *) mem_calloc (1, sizeof (sslsockdata));
+  ssldata = p_new(sslsockdata, 1);
   /* the ssl_use_xxx protocol options don't apply. We must use TLS in TLS. */
   if (!(ssldata->ctx = SSL_CTX_new (TLSv1_client_method ()))) {
     debug_print (1, ("Error allocating SSL_CTX\n"));
@@ -260,7 +257,7 @@ static int ssl_socket_open (CONNECTION * conn)
   if (raw_socket_open (conn) < 0)
     return -1;
 
-  data = (sslsockdata *) mem_calloc (1, sizeof (sslsockdata));
+  data = p_new(sslsockdata, 1);
   conn->sockdata = data;
 
   data->ctx = SSL_CTX_new (SSLv23_client_method ());
@@ -419,7 +416,7 @@ static char *x509_get_part (char *line, const char *ndx)
 
   c = strstr (line, ndx);
   if (c) {
-    c += str_len (ndx);
+    c += m_strlen(ndx);
     c2 = strchr (c, '/');
     if (c2)
       *c2 = '\0';
@@ -586,9 +583,9 @@ static int ssl_check_certificate (sslsockdata * data)
   /* interactive check from user */
   menu = mutt_new_menu ();
   menu->max = 19;
-  menu->dialog = (char **) mem_calloc (1, menu->max * sizeof (char *));
+  menu->dialog = p_new(char *, menu->max);
   for (i = 0; i < menu->max; i++)
-    menu->dialog[i] = (char *) mem_calloc (1, SHORT_STRING * sizeof (char));
+    menu->dialog[i] = p_new(char, SHORT_STRING);
 
   row = 0;
   strfcpy (menu->dialog[row], _("This certificate belongs to:"),