]> granicus.if.org Git - neomutt/commitdiff
build: expand a few more alloc macros
authorRichard Russon <rich@flatcap.org>
Wed, 15 Mar 2017 00:55:49 +0000 (00:55 +0000)
committerRichard Russon <rich@flatcap.org>
Wed, 22 Mar 2017 01:04:46 +0000 (01:04 +0000)
Following some early work, expand some more macros to functions:
- pgp_new_keyinfo()
- new_pattern()
- rfc822_new_address()

pgplib.h
protos.h
rfc822.h

index a4b8854494dac45b2d2f60c607ac1b03c5434658..2c818dfbb4a8a57102343d0e5bd80fc807ce1046 100644 (file)
--- a/pgplib.h
+++ b/pgplib.h
@@ -79,6 +79,9 @@ short pgp_get_abilities (unsigned char);
 
 void pgp_free_key (pgp_key_t *kpp);
 
-#define pgp_new_keyinfo() safe_calloc (sizeof *((pgp_key_t)0), 1)
+static inline pgp_key_t pgp_new_keyinfo(void)
+{
+    return safe_calloc (1, sizeof *((pgp_key_t)0));
+}
 
 #endif /* CRYPT_BACKEND_CLASSIC_PGP */
index e4e16255a593a0c05a4f23e0ecc6c421787c330b..1b978fd86f439f490d937736199b003de976cd8c 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -414,7 +414,10 @@ int mutt_wctoutf8 (char *s, unsigned int c, size_t buflen);
        (option (OPTLOCALES) ? 0 : (wc >= 0xa0)))
 #endif
 
-#define new_pattern() safe_calloc(1, sizeof (pattern_t))
+static inline pattern_t *new_pattern (void)
+{
+  return safe_calloc (1, sizeof (pattern_t));
+}
 
 int mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT *ctx, HEADER *h, pattern_cache_t *);
 pattern_t *mutt_pattern_comp (/* const */ char *s, int flags, BUFFER *err);
index f6825900c37fb718d2a161aa5be340d5a5b02971..c4b9ab497fb39ae4cffe885ca0e26db0b75f1f6c 100644 (file)
--- a/rfc822.h
+++ b/rfc822.h
@@ -65,6 +65,10 @@ extern int RFC822Error;
 extern const char * const RFC822Errors[];
 
 #define rfc822_error(x) RFC822Errors[x]
-#define rfc822_new_address() safe_calloc(1,sizeof(ADDRESS))
+
+static inline ADDRESS *rfc822_new_address (void)
+{
+  return safe_calloc (1, sizeof (ADDRESS));
+}
 
 #endif /* rfc822_h */