From 97836fae360422baf9c62dd0eb0de6e7b2cfab09 Mon Sep 17 00:00:00 2001 From: Christian Göttsche Date: Mon, 27 May 2024 21:32:37 +0200 Subject: Reorder calloc(3) arguments Please GCC: In file included from /usr/include/php/20220829/Zend/zend.h:30, from /usr/include/php/20220829/main/php.h:31, from /usr/include/php/20220829/main/SAPI.h:20, from src/php_snuffleupagus.h:37, from src/sp_ifilter.c:1: src/sp_pcre_compat.h: In function 'sp_regexp_compile': src/sp_pcre_compat.h:38:36: warning: '__zend_calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 38 | sp_regexp *ret = pecalloc(sizeof(sp_regexp), 1, 1); | ^~~~~~~~~ /usr/include/php/20220829/Zend/zend_alloc.h:199:72: note: in definition of macro 'pecalloc' 199 | #define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size))) | ^~~~~ src/sp_pcre_compat.h:38:36: note: earlier argument should specify number of elements, later size of each element 38 | sp_regexp *ret = pecalloc(sizeof(sp_regexp), 1, 1); | ^~~~~~~~~ /usr/include/php/20220829/Zend/zend_alloc.h:199:72: note: in definition of macro 'pecalloc' 199 | #define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size))) | ^~~~~ --- src/sp_list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp_list.c') diff --git a/src/sp_list.c b/src/sp_list.c index ab752f7..6a41fb4 100644 --- a/src/sp_list.c +++ b/src/sp_list.c @@ -53,7 +53,7 @@ sp_list_node *sp_list_sort(sp_list_node *pList, } sp_list_node *sp_list_insert(sp_list_node *list, void *data) { - sp_list_node *new = pecalloc(sizeof(*new), 1, 1); + sp_list_node *new = pecalloc(1, sizeof(*new), 1); sp_list_node *origin = list; new->data = data; new->next = NULL; @@ -70,7 +70,7 @@ sp_list_node *sp_list_insert(sp_list_node *list, void *data) { } sp_list_node *sp_list_prepend(sp_list_node *list, void *data) { - sp_list_node *new = pecalloc(sizeof(*new), 1, 1); + sp_list_node *new = pecalloc(1, sizeof(*new), 1); new->next = list; new->data = data; return new; -- cgit v1.3