Skip to content

Commit

Permalink
Fix syntax of calloc calls in pinelog.c
Browse files Browse the repository at this point in the history
`calloc` requires the count to be the first argument, and the size
parameter to be the second argument. However, this has not really caused
issues in the past, and older compilers were not so strict about it.

However, newer compilers (at least GCC 14) triggers a warning on this
and causes the build to fail.

Fixes #52
  • Loading branch information
nirenjan committed Jun 4, 2024
1 parent 9e2e8cb commit 21050e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pinelog/pinelog.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ int pinelog_init(int count) {
free(module_level);
free(module_name);

module_level = calloc(sizeof(*module_level), count);
module_level = calloc(count, sizeof(*module_level));
if (module_level == NULL) {
rc = errno;
goto cleanup;
}

module_name = calloc(sizeof(*module_name), count);
module_name = calloc(count, sizeof(*module_name));
if (module_name == NULL) {
rc = errno;
goto cleanup;
Expand Down

0 comments on commit 21050e4

Please sign in to comment.