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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-25 15:09:13 +02:00
committed by Enrico Weigelt
parent 23f26bd95e
commit e1b1c2f514

View File

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