From c67dc34d3f434b59b2574d07512a9894800ee8d1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 7 Aug 2021 15:19:33 +0200 Subject: [PATCH] malloca: Tweak last commit. * lib/malloca.h: Keep use and declaration of mmalloca close together. --- ChangeLog | 5 +++++ lib/malloca.h | 15 +++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7bdffe9438..47f05b35fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-08-07 Bruno Haible + + malloca: Tweak last commit. + * lib/malloca.h: Keep use and declaration of mmalloca close together. + 2021-08-07 Bruno Haible dirname-lgpl, sh-quote, system-quote, xstriconv: Clean up includes. diff --git a/lib/malloca.h b/lib/malloca.h index dbbec3f065..7eb63d2a75 100644 --- a/lib/malloca.h +++ b/lib/malloca.h @@ -51,6 +51,13 @@ extern "C" { # define safe_alloca(N) ((void) (N), NULL) #endif +/* Free a block of memory allocated through malloca(). */ +#if HAVE_ALLOCA +extern void freea (void *p); +#else +# define freea free +#endif + /* malloca(N) is a safe variant of alloca(N). It allocates N bytes of memory allocated on the stack, that must be freed using freea() before the function returns. Upon failure, it returns NULL. */ @@ -65,14 +72,6 @@ extern "C" { # define malloca(N) \ mmalloca (N) #endif - -/* Free a block of memory allocated through malloca(). */ -#if HAVE_ALLOCA -extern void freea (void *p); -#else -# define freea free -#endif - extern void *mmalloca (size_t n) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (freea, 1) _GL_ATTRIBUTE_ALLOC_SIZE ((1)); -- 2.39.5