]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
malloc.h: be a bit more consistent with macro definitions
authorRasmus Villemoes <ravi@prevas.dk>
Fri, 19 Sep 2025 10:09:54 +0000 (12:09 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 26 Sep 2025 17:55:13 +0000 (11:55 -0600)
Currrently, malloc and free are function-like macros, while calloc,
realloc and memalign are object-like macros.

Usually, this doesn't matter, but it does when the identifiers appear
without a following open parenthesis, such as when their address is
taken for building the export table. Adding calloc or realloc to that
table breaks the build on sandbox due to this inconsistency.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Reviewed-by: Tom Rini <trini@konsulko.com>
include/malloc.h

index 9e0be482416efc970dd52874a9de114493325f18..3979fc62830543b2f1ac0f44765eca44981d0ae0 100644 (file)
@@ -904,11 +904,11 @@ void *realloc_simple(void *ptr, size_t size);
 # define mALLOPt               dlmallopt
 
 /* Ensure that U-Boot actually uses these too */
-#define calloc dlcalloc
+#define calloc(x,y) dlcalloc(x,y)
 #define free(ptr) dlfree(ptr)
 #define malloc(x) dlmalloc(x)
-#define memalign dlmemalign
-#define realloc dlrealloc
+#define memalign(a,x) dlmemalign(a,x)
+#define realloc(p,x) dlrealloc(p,x)
 #define valloc dlvalloc
 #define pvalloc dlpvalloc
 #define mallinfo() dlmallinfo()