diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-05-18 23:31:41 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-05-18 23:32:57 -0700 |
commit | e997df8cd3c4222ea9fc3f0ebda728c4d1f15df5 (patch) | |
tree | ef3116f5dff68c9feeb240eb559cbc1356d949b4 /os | |
parent | 738672858d9399ecbc170500c15f90bf657502d2 (diff) |
XQuartz: Cleaned up ListenOnOpenFD...
(cherry picked from commit 6fb587d3d5fbbaee9e46cdce24d03e5d1c66d58a)
Diffstat (limited to 'os')
-rw-r--r-- | os/connection.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/os/connection.c b/os/connection.c index a87725782..316e347f2 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1301,8 +1301,7 @@ MakeClientGrabPervious(ClientPtr client) /* Add a fd (from launchd) to our listeners */ _X_EXPORT void ListenOnOpenFD(int fd) { char port[20]; - XtransConnInfo ciptr, *ciptr2, *ciptr3; - int *iptr, *iptr2; + XtransConnInfo ciptr; /* Sigh for inconsistencies. */ sprintf (port, ":%d", atoi(display)); @@ -1312,37 +1311,13 @@ _X_EXPORT void ListenOnOpenFD(int fd) { */ ciptr = _XSERVTransReopenCOTSServer(5, fd, port); if(ciptr == NULL) { - fprintf(stderr, "Got NULL while trying to Reopen launchd port.\n"); + ErrorF("Got NULL while trying to Reopen launchd port.\n"); return; } /* Allocate space to store it */ - iptr = (int *) realloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int)); - - if(!iptr) { - fprintf(stderr, "Memory allocation error"); - return; - } - - ciptr2 = (XtransConnInfo *) realloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo)); - if(!ciptr2) { - fprintf(stderr, "Memory allocation error"); - if(iptr != ListenTransFds) - free(ListenTransFds); - return; - } - - if(iptr != ListenTransFds) { - iptr2 = ListenTransFds; - ListenTransFds = iptr; - free(iptr2); - } - - if(ciptr2 != ListenTransConns) { - ciptr3 = ListenTransConns; - ListenTransConns = ciptr2; - free(ciptr3); - } + ListenTransFds = (int *) xrealloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int)); + ListenTransConns = (XtransConnInfo *) xrealloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo)); /* Store it */ ListenTransConns[ListenTransCount] = ciptr; @@ -1355,7 +1330,7 @@ _X_EXPORT void ListenOnOpenFD(int fd) { // DefineSelf (fd); } */ - + /* Increment the count */ ListenTransCount++; } |