From 8ef3f9e4ec1e75b24b84ab7ab3fb7a0e2b84b12d Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 14 Jul 2024 10:18:57 -0700 Subject: Fix -Wcalloc-transposed-args warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From gcc 14.1: Eyes.c: In function ‘EyesConfigure’: Eyes.c:132:45: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 132 | EyeConfiguration *c = calloc(sizeof(EyeConfiguration), 1); | ^~~~~~~~~~~~~~~~ Eyes.c:132:45: note: earlier argument should specify number of elements, later size of each element Eyes.c: In function ‘Initialize’: Eyes.c:409:36: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 409 | TPoint *pupils = calloc(sizeof(TPoint), config->count); | ^~~~~~ Eyes.c:409:36: note: earlier argument should specify number of elements, later size of each element Signed-off-by: Alan Coopersmith Part-of: --- Eyes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Eyes.c b/Eyes.c index 11a1f8e..87809c8 100644 --- a/Eyes.c +++ b/Eyes.c @@ -129,7 +129,7 @@ static EyeLayout layout_biblical[] = { static EyeConfiguration *EyesConfigure(Boolean biblically_accurate) { - EyeConfiguration *c = calloc(sizeof(EyeConfiguration), 1); + EyeConfiguration *c = calloc(1, sizeof(EyeConfiguration)); assert(c != NULL); if (biblically_accurate) { @@ -406,7 +406,7 @@ static void Initialize ( #endif EyeConfiguration *config = EyesConfigure(w->eyes.biblically_accurate); - TPoint *pupils = calloc(sizeof(TPoint), config->count); + TPoint *pupils = calloc(config->count, sizeof(TPoint)); assert(pupils != NULL); for (int j = 0; j < config->count; j++) { pupils[j].x = TPOINT_NONE; -- cgit v1.2.3