mallocng: prevent stray ';' at top-level

The LOCK_OBJ_DEF macro is used with a trailing semicolon. However,
since the macro definition ends with the closing brace of a function
definition, the ISO C grammar does not allow an extra semicolon.

To fix this, swap the order of the two definitions, and drop the
semicolon from the __malloc_lock declaration.
This commit is contained in:
Michael Forney
2026-03-10 22:48:21 -04:00
committed by Rich Felker
parent 1b76ff0767
commit 5c26c890ed
+2 -2
View File
@@ -62,8 +62,8 @@ __attribute__((__visibility__("hidden")))
extern int __malloc_lock[1];
#define LOCK_OBJ_DEF \
int __malloc_lock[1]; \
void __malloc_atfork(int who) { malloc_atfork(who); }
void __malloc_atfork(int who) { malloc_atfork(who); } \
int __malloc_lock[1]
static inline void rdlock()
{