From: Bruno Haible Date: Sat, 7 Aug 2021 13:19:33 +0000 (+0200) Subject: malloca: Tweak last commit. X-Git-Tag: v1.0~2719 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c67dc34d3f434b59b2574d07512a9894800ee8d1;p=gnulib.git malloca: Tweak last commit. * lib/malloca.h: Keep use and declaration of mmalloca close together. --- 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));