From: Tony Finch Date: Thu, 8 Jun 2023 11:57:32 +0000 (+0100) Subject: Remove some unnecessary token pasting macrology X-Git-Tag: v9.19.17~34^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52fcc9fc0f14502fa983b62b13c5d377cb35ac43;p=thirdparty%2Fbind9.git Remove some unnecessary token pasting macrology There used to be an extra layer of indirection in the memory functions for certain dynamic linking scenarios. This involved variant spellings like isc__mem and isc___mem. The isc___mem variants were removed in commit 7de846977b2a4fd3 so the token pasting is no longer needed and only serves to obfuscate. --- diff --git a/lib/isc/include/isc/mem.h b/lib/isc/include/isc/mem.h index 74083b7b614..8ba4169547f 100644 --- a/lib/isc/include/isc/mem.h +++ b/lib/isc/include/isc/mem.h @@ -154,71 +154,66 @@ extern unsigned int isc_mem_defaultflags; #endif #define ISC_MEM_ZERO ((int)0x40) -#define ISCMEMFUNC(sfx) isc__mem_##sfx -#define ISCMEMPOOLFUNC(sfx) isc__mempool_##sfx - -#define isc_mem_get(c, s) ISCMEMFUNC(get)((c), (s), 0 _ISC_MEM_FILELINE) -#define isc_mem_getx(c, s, f) ISCMEMFUNC(get)((c), (s), (f)_ISC_MEM_FILELINE) +#define isc_mem_get(c, s) isc__mem_get((c), (s), 0 _ISC_MEM_FILELINE) +#define isc_mem_getx(c, s, f) isc__mem_get((c), (s), (f)_ISC_MEM_FILELINE) #define isc_mem_reget(c, p, o, n) \ - ISCMEMFUNC(reget)((c), (p), (o), (n), 0 _ISC_MEM_FILELINE) + isc__mem_reget((c), (p), (o), (n), 0 _ISC_MEM_FILELINE) #define isc_mem_regetx(c, p, o, n, f) \ - ISCMEMFUNC(reget)((c), (p), (o), (n), (f)_ISC_MEM_FILELINE) -#define isc_mem_allocate(c, s) \ - ISCMEMFUNC(allocate)((c), (s), 0 _ISC_MEM_FILELINE) + isc__mem_reget((c), (p), (o), (n), (f)_ISC_MEM_FILELINE) +#define isc_mem_allocate(c, s) isc__mem_allocate((c), (s), 0 _ISC_MEM_FILELINE) #define isc_mem_allocatex(c, s, f) \ - ISCMEMFUNC(allocate)((c), (s), (f)_ISC_MEM_FILELINE) + isc__mem_allocate((c), (s), (f)_ISC_MEM_FILELINE) #define isc_mem_callocate(c, n, s) \ - ISCMEMFUNC(callocate)((c), (n), (s), 0 _ISC_MEM_FILELINE) + isc__mem_callocate((c), (n), (s), 0 _ISC_MEM_FILELINE) #define isc_mem_reallocate(c, p, s) \ - ISCMEMFUNC(reallocate)((c), (p), (s), 0 _ISC_MEM_FILELINE) + isc__mem_reallocate((c), (p), (s), 0 _ISC_MEM_FILELINE) #define isc_mem_reallocatex(c, p, s, f) \ - ISCMEMFUNC(reallocate)((c), (p), (s), (f)_ISC_MEM_FILELINE) -#define isc_mem_strdup(c, p) ISCMEMFUNC(strdup)((c), (p)_ISC_MEM_FILELINE) + isc__mem_reallocate((c), (p), (s), (f)_ISC_MEM_FILELINE) +#define isc_mem_strdup(c, p) isc__mem_strdup((c), (p)_ISC_MEM_FILELINE) #define isc_mem_strndup(c, p, l) \ - ISCMEMFUNC(strndup)((c), (p), (l)_ISC_MEM_FILELINE) -#define isc_mempool_get(c) ISCMEMPOOLFUNC(get)((c)_ISC_MEM_FILELINE) + isc__mem_strndup((c), (p), (l)_ISC_MEM_FILELINE) +#define isc_mempool_get(c) isc__mempool_get((c)_ISC_MEM_FILELINE) -#define isc_mem_put(c, p, s) \ - do { \ - ISCMEMFUNC(put)((c), (p), (s), 0 _ISC_MEM_FILELINE); \ - (p) = NULL; \ +#define isc_mem_put(c, p, s) \ + do { \ + isc__mem_put((c), (p), (s), 0 _ISC_MEM_FILELINE); \ + (p) = NULL; \ } while (0) -#define isc_mem_putx(c, p, s, f) \ - do { \ - ISCMEMFUNC(put) \ - ((c), (p), (s), (f)_ISC_MEM_FILELINE); \ - (p) = NULL; \ +#define isc_mem_putx(c, p, s, f) \ + do { \ + isc__mem_put((c), (p), (s), (f)_ISC_MEM_FILELINE); \ + (p) = NULL; \ } while (0) -#define isc_mem_putanddetach(c, p, s) \ - do { \ - ISCMEMFUNC(putanddetach)((c), (p), (s), 0 _ISC_MEM_FILELINE); \ - (p) = NULL; \ +#define isc_mem_putanddetach(c, p, s) \ + do { \ + isc__mem_putanddetach((c), (p), (s), 0 _ISC_MEM_FILELINE); \ + (p) = NULL; \ } while (0) -#define isc_mem_putanddetachx(c, p, s, f) \ - do { \ - ISCMEMFUNC(putanddetach) \ - ((c), (p), (s), (f)_ISC_MEM_FILELINE); \ - (p) = NULL; \ +#define isc_mem_putanddetachx(c, p, s, f) \ + do { \ + isc__mem_putanddetach((c), (p), (s), (f)_ISC_MEM_FILELINE); \ + (p) = NULL; \ } while (0) -#define isc_mem_free(c, p) \ - do { \ - ISCMEMFUNC(free)((c), (p), 0 _ISC_MEM_FILELINE); \ - (p) = NULL; \ +#define isc_mem_free(c, p) \ + do { \ + isc__mem_free((c), (p), 0 _ISC_MEM_FILELINE); \ + (p) = NULL; \ } while (0) -#define isc_mem_freex(c, p, f) \ - do { \ - ISCMEMFUNC(free)((c), (p), (f)_ISC_MEM_FILELINE); \ - (p) = NULL; \ +#define isc_mem_freex(c, p, f) \ + do { \ + isc__mem_free((c), (p), (f)_ISC_MEM_FILELINE); \ + (p) = NULL; \ } while (0) -#define isc_mempool_put(c, p) \ - do { \ - ISCMEMPOOLFUNC(put)((c), (p)_ISC_MEM_FILELINE); \ - (p) = NULL; \ +#define isc_mempool_put(c, p) \ + do { \ + isc__mempool_put((c), (p)_ISC_MEM_FILELINE); \ + (p) = NULL; \ } while (0) /*@{*/ -#define isc_mem_create(cp) ISCMEMFUNC(create)((cp)_ISC_MEM_FILELINE) -void ISCMEMFUNC(create)(isc_mem_t **_ISC_MEM_FLARG); +#define isc_mem_create(cp) isc__mem_create((cp)_ISC_MEM_FILELINE) +void +isc__mem_create(isc_mem_t **_ISC_MEM_FLARG); /*!< * \brief Create a memory context. @@ -230,8 +225,9 @@ void ISCMEMFUNC(create)(isc_mem_t **_ISC_MEM_FLARG); /*@{*/ void isc_mem_attach(isc_mem_t *, isc_mem_t **); -#define isc_mem_detach(cp) ISCMEMFUNC(detach)((cp)_ISC_MEM_FILELINE) -void ISCMEMFUNC(detach)(isc_mem_t **_ISC_MEM_FLARG); +#define isc_mem_detach(cp) isc__mem_detach((cp)_ISC_MEM_FILELINE) +void +isc__mem_detach(isc_mem_t **_ISC_MEM_FLARG); /*!< * \brief Attach to / detach from a memory context. * @@ -246,8 +242,9 @@ void ISCMEMFUNC(detach)(isc_mem_t **_ISC_MEM_FLARG); */ /*@}*/ -#define isc_mem_destroy(cp) ISCMEMFUNC(destroy)((cp)_ISC_MEM_FILELINE) -void ISCMEMFUNC(destroy)(isc_mem_t **_ISC_MEM_FLARG); +#define isc_mem_destroy(cp) isc__mem_destroy((cp)_ISC_MEM_FILELINE) +void +isc__mem_destroy(isc_mem_t **_ISC_MEM_FLARG); /*%< * Destroy a memory context. */ @@ -501,38 +498,49 @@ isc_mempool_setfillcount(isc_mempool_t *restrict mpctx, /* * Pseudo-private functions for use via macros. Do not call directly. */ -void ISCMEMFUNC(putanddetach)(isc_mem_t **, void *, size_t, int _ISC_MEM_FLARG); -void ISCMEMFUNC(put)(isc_mem_t *, void *, size_t, int _ISC_MEM_FLARG); -void ISCMEMFUNC(free)(isc_mem_t *, void *, int _ISC_MEM_FLARG); +void +isc__mem_putanddetach(isc_mem_t **, void *, size_t, int _ISC_MEM_FLARG); +void +isc__mem_put(isc_mem_t *, void *, size_t, int _ISC_MEM_FLARG); +void +isc__mem_free(isc_mem_t *, void *, int _ISC_MEM_FLARG); -ISC_ATTR_MALLOC_DEALLOCATOR_IDX(ISCMEMFUNC(put), 2) -void *ISCMEMFUNC(get)(isc_mem_t *, size_t, int _ISC_MEM_FLARG); +ISC_ATTR_MALLOC_DEALLOCATOR_IDX(isc__mem_put, 2) +void * +isc__mem_get(isc_mem_t *, size_t, int _ISC_MEM_FLARG); -ISC_ATTR_DEALLOCATOR_IDX(ISCMEMFUNC(put), 2) -void *ISCMEMFUNC(reget)(isc_mem_t *, void *, size_t, size_t, - int _ISC_MEM_FLARG); +ISC_ATTR_DEALLOCATOR_IDX(isc__mem_put, 2) +void * +isc__mem_reget(isc_mem_t *, void *, size_t, size_t, int _ISC_MEM_FLARG); -ISC_ATTR_MALLOC_DEALLOCATOR_IDX(ISCMEMFUNC(free), 2) -void *ISCMEMFUNC(allocate)(isc_mem_t *, size_t, int _ISC_MEM_FLARG); +ISC_ATTR_MALLOC_DEALLOCATOR_IDX(isc__mem_free, 2) +void * +isc__mem_allocate(isc_mem_t *, size_t, int _ISC_MEM_FLARG); -ISC_ATTR_MALLOC_DEALLOCATOR_IDX(ISCMEMFUNC(free), 2) -void *ISCMEMFUNC(callocate)(isc_mem_t *, size_t, size_t, int _ISC_MEM_FLARG); +ISC_ATTR_MALLOC_DEALLOCATOR_IDX(isc__mem_free, 2) +void * +isc__mem_callocate(isc_mem_t *, size_t, size_t, int _ISC_MEM_FLARG); -ISC_ATTR_DEALLOCATOR_IDX(ISCMEMFUNC(free), 2) -void *ISCMEMFUNC(reallocate)(isc_mem_t *, void *, size_t, int _ISC_MEM_FLARG); +ISC_ATTR_DEALLOCATOR_IDX(isc__mem_free, 2) +void * +isc__mem_reallocate(isc_mem_t *, void *, size_t, int _ISC_MEM_FLARG); ISC_ATTR_RETURNS_NONNULL -ISC_ATTR_MALLOC_DEALLOCATOR_IDX(ISCMEMFUNC(free), 2) -char *ISCMEMFUNC(strdup)(isc_mem_t *, const char *_ISC_MEM_FLARG); +ISC_ATTR_MALLOC_DEALLOCATOR_IDX(isc__mem_free, 2) +char * +isc__mem_strdup(isc_mem_t *, const char *_ISC_MEM_FLARG); ISC_ATTR_RETURNS_NONNULL -ISC_ATTR_MALLOC_DEALLOCATOR_IDX(ISCMEMFUNC(free), 2) -char *ISCMEMFUNC(strndup)(isc_mem_t *, const char *, size_t _ISC_MEM_FLARG); +ISC_ATTR_MALLOC_DEALLOCATOR_IDX(isc__mem_free, 2) +char * +isc__mem_strndup(isc_mem_t *, const char *, size_t _ISC_MEM_FLARG); -ISC_ATTR_MALLOC_DEALLOCATOR_IDX(ISCMEMPOOLFUNC(put), 2) -void *ISCMEMPOOLFUNC(get)(isc_mempool_t *_ISC_MEM_FLARG); +ISC_ATTR_MALLOC_DEALLOCATOR_IDX(isc__mempool_put, 2) +void * +isc__mempool_get(isc_mempool_t *_ISC_MEM_FLARG); -void ISCMEMPOOLFUNC(put)(isc_mempool_t *, void *_ISC_MEM_FLARG); +void +isc__mempool_put(isc_mempool_t *, void *_ISC_MEM_FLARG); #ifdef POP_MALLOC_MACRO /*