mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 10:14:52 +00:00
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:
committed by
Enrico Weigelt
parent
23f26bd95e
commit
e1b1c2f514
10
os/ospoll.c
10
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;
|
||||
|
||||
Reference in New Issue
Block a user