diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-01 20:27:01 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-01 20:27:01 +0200 |
commit | 4ddc25b1867cc76a98dedf18f235dfb2d8b13c51 (patch) | |
tree | 9fcaa660b80f74be1267c7c5134f705f3ba2e82a | |
parent | 1b5d783c50c22c74adfe4687bc1d7192ed9ad2d5 (diff) |
More usage of reallocarray()
-rw-r--r-- | FICS/makerank.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/FICS/makerank.c b/FICS/makerank.c index a86b0ec..8f091b7 100644 --- a/FICS/makerank.c +++ b/FICS/makerank.c @@ -162,12 +162,11 @@ LoadEntries(void) if (++n == listsize) { listsize += 100; - list = realloc(list, listsize * + list = reallocarray(list, + listsize, sizeof(ENTRY *)); - if (list == NULL) { - err(1, "%s: realloc", - __func__); - } + if (list == NULL) + err(1, NULL); } } } @@ -249,10 +248,11 @@ makerank(void) if (sortnum == sortmesize) { sortmesize += 100; - sortme = realloc(sortme, sortmesize * + sortme = reallocarray(sortme, + sortmesize, sizeof(ENTRY *)); if (sortme == NULL) - err(1, "%s: realloc", __func__); + err(1, NULL); } } } |