From 21050e40a854fc2736c4b76a9f86c68052fd75d2 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Tue, 4 Jun 2024 15:02:27 -0700 Subject: [PATCH] Fix syntax of calloc calls in pinelog.c `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 --- lib/pinelog/pinelog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pinelog/pinelog.c b/lib/pinelog/pinelog.c index b4eb832..3d07133 100644 --- a/lib/pinelog/pinelog.c +++ b/lib/pinelog/pinelog.c @@ -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;