]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/alloc/: REALLOC[F](): Move _Generic(3) to separate line
authorAlejandro Colomar <alx@kernel.org>
Fri, 14 Nov 2025 00:50:11 +0000 (01:50 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sat, 6 Dec 2025 03:22:45 +0000 (21:22 -0600)
This should be more readable.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/alloc/realloc.h
lib/alloc/reallocf.h

index 09599c09f621d3579d1f5ff3dc7bb5285502f46a..4ba928e4a1de3dd84057b21f4dd80e491d3c9f2f 100644 (file)
@@ -17,7 +17,8 @@
 #define REALLOC(p, n, T)   REALLOC_(p, n, typeas(T))
 #define REALLOC_(p, n, T)                                             \
 ({                                                                    \
-       _Generic(p, T *: (T *){reallocarray_(p, n, sizeof(T))});      \
+       _Generic(p, T *: (void)0);                                    \
+       (T *){reallocarray_(p, n, sizeof(T))};                        \
 })
 
 #define reallocarray_(p, n, size)  reallocarray(p, (n) ?: 1, (size) ?: 1)
index 5854aa9c521e44ae81ac05b14ca65be77bc846cd..009ae79b8763cf0a8f1e87e415a1196a1a228d20 100644 (file)
@@ -18,7 +18,8 @@
 #define REALLOCF(p, n, T)   REALLOCF_(p, n, typeas(T))
 #define REALLOCF_(p, n, T)                                            \
 ({                                                                    \
-       _Generic(p, T *: (T *){reallocarrayf_(p, n, sizeof(T))});     \
+       _Generic(p, T *: (void)0);                                    \
+       (T *){reallocarrayf_(p, n, sizeof(T))};                       \
 })
 
 #define reallocarrayf_(p, n, size)  reallocarrayf(p, (n) ?: 1, (size) ?: 1)