From e1b1c2f514b73c2ed70a538947a84fd07f9146b4 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 25 Jul 2025 15:09:13 +0200 Subject: [PATCH] os: ospoll: use realloc() instead of reallocarray() MacOS doesn't support reallocarray(), and we can't include os.h here on win32/mingw. Signed-off-by: Enrico Weigelt, metux IT consult --- os/ospoll.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/os/ospoll.c b/os/ospoll.c index 10992d4600..c24acb6426 100644 --- a/os/ospoll.c +++ b/os/ospoll.c @@ -284,7 +284,7 @@ ospoll_add(struct ospoll *ospoll, int fd, struct ospollfd *new_fds; int new_size = ospoll->size ? ospoll->size * 2 : MAXCLIENTS * 2; - new_fds = reallocarray(ospoll->fds, new_size, sizeof (ospoll->fds[0])); + new_fds = realloc(ospoll->fds, new_size * sizeof (ospoll->fds[0])); if (!new_fds) return FALSE; ospoll->fds = new_fds; @@ -314,7 +314,7 @@ ospoll_add(struct ospoll *ospoll, int fd, struct ospollfd **new_fds; int new_size = ospoll->size ? ospoll->size * 2 : MAXCLIENTS * 2; - new_fds = reallocarray(ospoll->fds, new_size, sizeof (ospoll->fds[0])); + new_fds = realloc(ospoll->fds, new_size * sizeof (ospoll->fds[0])); if (!new_fds) { free (osfd); return FALSE; @@ -352,7 +352,7 @@ ospoll_add(struct ospoll *ospoll, int fd, struct ospollfd **new_fds; int new_size = ospoll->size ? ospoll->size * 2 : MAXCLIENTS * 2; - new_fds = reallocarray(ospoll->fds, new_size, sizeof (ospoll->fds[0])); + new_fds = realloc(ospoll->fds, new_size * sizeof (ospoll->fds[0])); if (!new_fds) { free (osfd); return FALSE; @@ -390,11 +390,11 @@ ospoll_add(struct ospoll *ospoll, int fd, struct ospollfd *new_osfds; int new_size = ospoll->size ? ospoll->size * 2 : MAXCLIENTS * 2; - new_fds = reallocarray(ospoll->fds, new_size, sizeof (ospoll->fds[0])); + new_fds = realloc(ospoll->fds, new_size * sizeof (ospoll->fds[0])); if (!new_fds) return FALSE; ospoll->fds = new_fds; - new_osfds = reallocarray(ospoll->osfds, new_size, sizeof (ospoll->osfds[0])); + new_osfds = realloc(ospoll->osfds, new_size * sizeof (ospoll->osfds[0])); if (!new_osfds) return FALSE; ospoll->osfds = new_osfds;