From e0188195a3994f5fbeec1fd646906eec612093b1 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 7 Feb 2024 15:11:35 +0100 Subject: [PATCH] Fix -Wcalloc-transposed-args warning The calloc(3) function has two arguments: the number of members, and the size of one member. sizeof(...) makes more sense as member size, and 1 as number of members. At least that is what the gcc warning wants. This was the only compiler warning I could get on my Fedora 40 test build (gcc 14) with CFLAGS="-Wall -Wextra -Werror". --- src/avrftdi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avrftdi.c b/src/avrftdi.c index 0afd8384..d1d6bfc6 100644 --- a/src/avrftdi.c +++ b/src/avrftdi.c @@ -1271,7 +1271,7 @@ avrftdi_setup(PROGRAMMER * pgm) avrftdi_t* pdata; - if(!(pgm->cookie = calloc(sizeof(avrftdi_t), 1))) { + if(!(pgm->cookie = calloc(1, sizeof(avrftdi_t)))) { log_err("Error allocating memory.\n"); exit(1); }