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".
This commit is contained in:
Hans Ulrich Niedermann
2024-02-07 15:11:35 +01:00
parent 0179026e09
commit e0188195a3

View File

@@ -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);
}