From be463b090fa8451481ba5757fa23dffdc9311679 Mon Sep 17 00:00:00 2001 From: ruihongw Date: Fri, 3 Jul 2020 16:07:54 +0800 Subject: [PATCH] optimize calloc() args order --- doc/examples/urcu-flavors/bp.c | 2 +- doc/examples/urcu-flavors/mb.c | 2 +- doc/examples/urcu-flavors/membarrier.c | 2 +- doc/examples/urcu-flavors/qsbr.c | 2 +- doc/examples/urcu-flavors/signal.c | 2 +- src/urcu-call-rcu-impl.h | 4 ++-- src/workqueue.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/examples/urcu-flavors/bp.c b/doc/examples/urcu-flavors/bp.c index 1875a860..6e566a62 100644 --- a/doc/examples/urcu-flavors/bp.c +++ b/doc/examples/urcu-flavors/bp.c @@ -46,7 +46,7 @@ int add_node(uint64_t v) { struct mynode *node; - node = calloc(sizeof(*node), 1); + node = calloc(1, sizeof(*node)); if (!node) return -1; node->value = v; diff --git a/doc/examples/urcu-flavors/mb.c b/doc/examples/urcu-flavors/mb.c index e103e4f9..b0281dd8 100644 --- a/doc/examples/urcu-flavors/mb.c +++ b/doc/examples/urcu-flavors/mb.c @@ -47,7 +47,7 @@ int add_node(uint64_t v) { struct mynode *node; - node = calloc(sizeof(*node), 1); + node = calloc(1, sizeof(*node)); if (!node) return -1; node->value = v; diff --git a/doc/examples/urcu-flavors/membarrier.c b/doc/examples/urcu-flavors/membarrier.c index f9523d5d..4e021ad3 100644 --- a/doc/examples/urcu-flavors/membarrier.c +++ b/doc/examples/urcu-flavors/membarrier.c @@ -47,7 +47,7 @@ int add_node(uint64_t v) { struct mynode *node; - node = calloc(sizeof(*node), 1); + node = calloc(1, sizeof(*node)); if (!node) return -1; node->value = v; diff --git a/doc/examples/urcu-flavors/qsbr.c b/doc/examples/urcu-flavors/qsbr.c index 7af8ada3..c47349cb 100644 --- a/doc/examples/urcu-flavors/qsbr.c +++ b/doc/examples/urcu-flavors/qsbr.c @@ -46,7 +46,7 @@ int add_node(uint64_t v) { struct mynode *node; - node = calloc(sizeof(*node), 1); + node = calloc(1, sizeof(*node)); if (!node) return -1; node->value = v; diff --git a/doc/examples/urcu-flavors/signal.c b/doc/examples/urcu-flavors/signal.c index e396b9ef..954862c2 100644 --- a/doc/examples/urcu-flavors/signal.c +++ b/doc/examples/urcu-flavors/signal.c @@ -46,7 +46,7 @@ int add_node(uint64_t v) { struct mynode *node; - node = calloc(sizeof(*node), 1); + node = calloc(1, sizeof(*node)); if (!node) return -1; node->value = v; diff --git a/src/urcu-call-rcu-impl.h b/src/urcu-call-rcu-impl.h index b6ec6ba3..a1aecde6 100644 --- a/src/urcu-call-rcu-impl.h +++ b/src/urcu-call-rcu-impl.h @@ -893,7 +893,7 @@ void rcu_barrier(void) goto online; } - completion = calloc(sizeof(*completion), 1); + completion = calloc(1, sizeof(*completion)); if (!completion) urcu_die(errno); @@ -908,7 +908,7 @@ void rcu_barrier(void) cds_list_for_each_entry(crdp, &call_rcu_data_list, list) { struct call_rcu_completion_work *work; - work = calloc(sizeof(*work), 1); + work = calloc(1, sizeof(*work)); if (!work) urcu_die(errno); work->completion = completion; diff --git a/src/workqueue.c b/src/workqueue.c index 59eb21d5..70c2cea8 100644 --- a/src/workqueue.c +++ b/src/workqueue.c @@ -412,7 +412,7 @@ void urcu_workqueue_queue_completion(struct urcu_workqueue *workqueue, { struct urcu_workqueue_completion_work *work; - work = calloc(sizeof(*work), 1); + work = calloc(1, sizeof(*work)); if (!work) urcu_die(errno); work->completion = completion;