From: Alejandro Colomar Date: Fri, 14 Nov 2025 00:50:11 +0000 (+0100) Subject: lib/alloc/: REALLOC[F](): Move _Generic(3) to separate line X-Git-Tag: 4.19.0-rc1~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0a0c35cd8280ae4f5f6613ec7bc77125ff430e0;p=thirdparty%2Fshadow.git lib/alloc/: REALLOC[F](): Move _Generic(3) to separate line This should be more readable. Signed-off-by: Alejandro Colomar --- diff --git a/lib/alloc/realloc.h b/lib/alloc/realloc.h index 09599c09..4ba928e4 100644 --- a/lib/alloc/realloc.h +++ b/lib/alloc/realloc.h @@ -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) diff --git a/lib/alloc/reallocf.h b/lib/alloc/reallocf.h index 5854aa9c..009ae79b 100644 --- a/lib/alloc/reallocf.h +++ b/lib/alloc/reallocf.h @@ -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)