#include "recvattach.h"
#include "sort.h"
-#include "lib/mem.h"
#include "lib/intl.h"
#include "lib/str.h"
#include "lib/debug.h"
}
/* Return a copy of KEY. */
-static crypt_key_t *crypt_copy_key (crypt_key_t * key)
+static crypt_key_t *crypt_copy_key (crypt_key_t *key)
{
crypt_key_t *k;
- k = mem_calloc (1, sizeof *k);
+ k = p_new(crypt_key_t, 1);
k->kobj = key->kobj;
gpgme_key_ref (key->kobj);
k->idx = key->idx;
err = gpgme_get_key (context, buf, &key, 0);
if (!err) {
- mem_realloc (&rset, sizeof (*rset) * (rset_n + 1));
+ p_realloc(&rset, rset_n + 1);
rset[rset_n++] = key;
}
else {
}
/* NULL terminate. */
- mem_realloc (&rset, sizeof (*rset) * (rset_n + 1));
+ p_realloc(&rset, rset_n + 1);
rset[rset_n++] = NULL;
if (context)
n++; /* delimiter or end of string */
}
n++; /* make sure to allocate at least one byte */
- pattern = p = mem_calloc (1, n);
+ pattern = p = p_new(char, n);
for (l = list; l; l = l->next) {
s = l->data;
if (*s) {
if (!n)
goto no_pgphints;
- patarr = mem_calloc (n + 1, sizeof *patarr);
+ patarr = p_new(char *, n + 1);
for (l = hints, n = 0; l; l = l->next) {
if (l->data && *l->data)
patarr[n++] = str_dup (l->data);
#endif /* DISABLED code */
for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next) {
- k = mem_calloc (1, sizeof *k);
+ k = p_new(crypt_key_t, 1);
k->kobj = key;
k->idx = idx;
k->uid = uid->uid;
flags |= KEYFLAG_CANSIGN;
for (idx = 0, uid = key->uids; uid; idx++, uid = uid->next) {
- k = mem_calloc (1, sizeof *k);
+ k = p_new(crypt_key_t, 1);
k->kobj = key;
k->idx = idx;
k->uid = uid->uid;
if (i == keymax) {
keymax += 20;
- mem_realloc (&key_table, sizeof (crypt_key_t *) * keymax);
+ p_realloc(&key_table, keymax);
}
key_table[i++] = k;
#endif
keylist_size += str_len (s) + 4 + 1;
- mem_realloc (&keylist, keylist_size);
+ p_realloc(&keylist, keylist_size);
sprintf (keylist + keylist_used, "%s0x%s%s", /* __SPRINTF_CHECKED__ */
keylist_used ? " " : "", s, forced_valid ? "!" : "");
}