Fix gcc calloc() warning

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 <aik@ozlabs.ru>
This commit is contained in:
Alexey Kardashevskiy 2025-01-01 11:47:18 +11:00 committed by Alexey Kardashevskiy
parent 05f6e4e000
commit 1801e5c552

View File

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