# include "config.h"
#endif
-#include "lib/mem.h"
+#include <lib-lib/mem.h>
+
#include "lib/str.h"
#include <stdio.h>
bailout:
- mem_free (&p);
+ p_delete(&p);
return NULL;
}
case PT_SIG:
{
if (lsig) {
- pgp_sig_t *signature = mem_calloc (sizeof (pgp_sig_t), 1);
+ pgp_sig_t *signature = p_new(pgp_sig_t, 1);
*lsig = signature;
lsig = &signature->next;
if (!addr)
break;
- chr = mem_malloc (l);
- memcpy (chr, buff + 1, l - 1);
- chr[l - 1] = '\0';
-
+ chr = p_dupstr(buff + 1, l - 1);
- *addr = uid = mem_calloc (1, sizeof (pgp_uid_t)); /* XXX */
+ *addr = uid = p_new(pgp_uid_t, 1); /* XXX */
uid->addr = chr;
uid->parent = p;
uid->trust = 0;
size_t error_buf_len;
error_buf_len = sizeof ("fopen: ") - 1 + str_len (ringfile) + 1;
- error_buf = mem_malloc (error_buf_len);
+ error_buf = p_new(char, error_buf_len);
snprintf (error_buf, error_buf_len, "fopen: %s", ringfile);
perror (error_buf);
- mem_free (&error_buf);
+ p_delete(&error_buf);
return;
}
keypos = pos;
}
else if (pt == PT_NAME) {
- char *tmp = mem_malloc (l);
-
- memcpy (tmp, buff + 1, l - 1);
- tmp[l - 1] = '\0';
+ char *tmp = p_dupstr(buff + 1, l - 1);
/* mutt_decode_utf8_string (tmp, chs); */
pgp_free_key (&p);
}
- mem_free (&tmp);
+ p_delete(&tmp);
}
FGETPOS (rfp, pos);