From 1801e5c552ed1c25259809e06a7fdc8479307707 Mon Sep 17 00:00:00 2001 From: Alexey Kardashevskiy Date: Wed, 1 Jan 2025 11:47:18 +1100 Subject: [PATCH] Fix gcc calloc() warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc (GCC) 14.1.1 20240701 (Red Hat 14.1.1-7) produces this: network.c:159:57: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and no t in the later argument [-Wcalloc-transposed-args] 159 | (struct read_lines_s *) safecalloc (sizeof (struct read_lines_s), | ^~~~~~ Fix them. Signed-off-by: Alexey Kardashevskiy --- src/network.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/network.c b/src/network.c index 224f924..a0c1766 100644 --- a/src/network.c +++ b/src/network.c @@ -156,8 +156,7 @@ ssize_t readline (int fd, char **whole_buffer) struct read_lines_s *first_line, *line_ptr; first_line = - (struct read_lines_s *) safecalloc (sizeof (struct read_lines_s), - 1); + (struct read_lines_s *) safecalloc (1, sizeof (struct read_lines_s)); if (!first_line) return -ENOMEM; @@ -206,7 +205,7 @@ ssize_t readline (int fd, char **whole_buffer) line_ptr->next = (struct read_lines_s *) - safecalloc (sizeof (struct read_lines_s), 1); + safecalloc (1, sizeof (struct read_lines_s)); if (!line_ptr->next) { ret = -ENOMEM; goto CLEANUP;