From 449cf35032e5437d7beb00289a8fdd27b57e46a0 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 7 May 2024 16:39:54 -0400 Subject: [PATCH] shared/util: Fix build error on malloc0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the parameter order of calloc which causes the following error on recent gcc: CC client/mgmt.o In file included from client/mgmt.c:43: client/mgmt.c: In function ‘cmd_add_ext_adv_params’: client/mgmt.c:5057:28: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 5057 | cp = malloc0(sizeof(*cp)); | --- src/shared/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/util.h b/src/shared/util.h index a8ba23499..bd71577d6 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -85,7 +85,7 @@ do { \ })) #define newa(t, n) ((t*) alloca(sizeof(t)*(n))) -#define malloc0(n) (calloc((n), 1)) +#define malloc0(n) (calloc(1, (n))) char *strdelimit(char *str, char *del, char c); int strsuffix(const char *str, const char *suffix); -- 2.47.3