src: reverse calloc() invocation
Pablo Neira Ayuso
maintainerPATCH 1/1 src: reverse calloc() invocation
Swap object size and number of elements, so number of elements is the first argument, then object size is the second argument.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/conntrack/api.c | 6 +++--- src/conntrack/labels.c | 2 +- src/conntrack/stack.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
src/conntrack/api.c +3 -3
@@ -307,7 +307,7 @@ int nfct_callback_register2(struct nfct_handle *h,assert (h !=NULL ); - container =calloc (sizeof (struct __data_container ),1 ); + container =calloc (1 ,sizeof (struct __data_container ));if (container ==NULL )return -1 ;
@@ -1361,7 +1361,7 @@ void nfct_copy_attr(struct nf_conntrack *ct1,*/ struct nfct_filter *nfct_filter_create (void ) { -return calloc (sizeof (struct nfct_filter ),1 ); +return calloc (1 ,sizeof (struct nfct_filter )); }/**
@@ -1500,7 +1500,7 @@ int nfct_filter_detach(int fd)*/ struct nfct_filter_dump *nfct_filter_dump_create (void ) { -return calloc (sizeof (struct nfct_filter_dump ),1 ); +return calloc (1 ,sizeof (struct nfct_filter_dump )); }/**
src/conntrack/labels.c +1 -1
@@ -268,7 +268,7 @@ struct nfct_labelmap *__labelmap_new(const char *name)if (added) { map->namecount = maxbit +1 ; - map->bit_to_name =calloc (sizeof (char *), map->namecount); + map->bit_to_name =calloc (map->namecount,sizeof (char *));if (!map->bit_to_name) goto err;make_name_table (map);
src/conntrack/stack.c +2 -2
@@ -25,11 +25,11 @@ struct stack *stack_create(size_t elem_size, int max_elems) {struct stack *s; - s =calloc (sizeof (struct stack ),1 ); + s =calloc (1 ,sizeof (struct stack ));if (s ==NULL )return NULL ; - s->data =calloc (elem_size * max_elems,1 ); + s->data =calloc (max_elems, elem_size);if (s->data ==NULL ) {free (s);return NULL ;
Signature · 1 line
2.30.2