From d8a30422b8e9199635b02b873dc3825709737abe Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Wed, 15 Mar 2017 00:55:49 +0000 Subject: [PATCH] build: expand a few more alloc macros Following some early work, expand some more macros to functions: - pgp_new_keyinfo() - new_pattern() - rfc822_new_address() --- pgplib.h | 5 ++++- protos.h | 5 ++++- rfc822.h | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pgplib.h b/pgplib.h index a4b885449..2c818dfbb 100644 --- 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 */ diff --git a/protos.h b/protos.h index e4e16255a..1b978fd86 100644 --- 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); diff --git a/rfc822.h b/rfc822.h index f6825900c..c4b9ab497 100644 --- 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 */ -- 2.40.0