GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
lib/ext2fs/hashmap.c:37:36: warning: allocation of insufficient size ‘1’ for type ‘struct ext2fs_hashmap’ with size ‘20’ [-Walloc-size]
The calloc prototype is:
void *calloc(size_t nmemb, size_t size);
So, just swap the number of members and size arguments to match the prototype, as we're initialising 1 struct of size sizeof(...). GCC then sees we're not doing anything wrong.
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
The calloc prototype is:
So, just swap the number of members and size arguments to match the prototype, as we're initialising 1 struct of size
sizeof(...)
. GCC then sees we're not doing anything wrong.