From acf87144d019f18e646501657d9082c6eba77f54 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 26 Jun 2016 01:38:22 +0200 Subject: nx-X11/programs/Xserver: Drop {X,x}free() macros, use free() instead. Fixes ArcticaProject/nx-libs#105 --- nx-X11/lib/xtrans/Xtrans.c | 52 ++++++++++++++--------------- nx-X11/lib/xtrans/Xtransdnet.c | 10 +++--- nx-X11/lib/xtrans/Xtranslcl.c | 20 +++++------ nx-X11/lib/xtrans/Xtransos2.c | 76 +++++++++++++++++++++--------------------- nx-X11/lib/xtrans/Xtranssock.c | 30 ++++++++--------- nx-X11/lib/xtrans/Xtranstli.c | 28 ++++++++-------- nx-X11/lib/xtrans/Xtransutil.c | 4 +-- nx-X11/lib/xtrans/transport.c | 1 - 8 files changed, 110 insertions(+), 111 deletions(-) (limited to 'nx-X11/lib') diff --git a/nx-X11/lib/xtrans/Xtrans.c b/nx-X11/lib/xtrans/Xtrans.c index ef4d64aed..f1e5ff966 100644 --- a/nx-X11/lib/xtrans/Xtrans.c +++ b/nx-X11/lib/xtrans/Xtrans.c @@ -145,15 +145,15 @@ TRANS(FreeConnInfo) (XtransConnInfo ciptr) PRMSG (3,"FreeConnInfo(%p)\n", ciptr, 0, 0); if (ciptr->addr) - xfree (ciptr->addr); + free (ciptr->addr); if (ciptr->peeraddr) - xfree (ciptr->peeraddr); + free (ciptr->peeraddr); if (ciptr->port) - xfree (ciptr->port); + free (ciptr->port); - xfree ((char *) ciptr); + free ((char *) ciptr); } @@ -238,7 +238,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) *protocol = NULL; *host = NULL; *port = NULL; - xfree (tmpptr); + free (tmpptr); return 0; } @@ -288,7 +288,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) *protocol = NULL; *host = NULL; *port = NULL; - xfree (tmpptr); + free (tmpptr); return 0; } @@ -368,7 +368,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) *port = NULL; *host = NULL; *protocol = NULL; - xfree (tmpptr); + free (tmpptr); return 0; } else @@ -379,9 +379,9 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) /* Malloc failed */ *port = NULL; *host = NULL; - xfree (*protocol); + free (*protocol); *protocol = NULL; - xfree (tmpptr); + free (tmpptr); return 0; } else @@ -391,17 +391,17 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) { /* Malloc failed */ *port = NULL; - xfree (*host); + free (*host); *host = NULL; - xfree (*protocol); + free (*protocol); *protocol = NULL; - xfree (tmpptr); + free (tmpptr); return 0; } else strcpy (*port, _port); - xfree (tmpptr); + free (tmpptr); return 1; } @@ -446,9 +446,9 @@ TRANS(Open) (int type, char *address) PRMSG (1,"Open: Unable to find transport for %s\n", protocol, 0, 0); - xfree (protocol); - xfree (host); - xfree (port); + free (protocol); + free (host); + free (port); return NULL; } @@ -487,17 +487,17 @@ TRANS(Open) (int type, char *address) PRMSG (1,"Open: transport open failed for %s/%s:%s\n", protocol, host, port); } - xfree (protocol); - xfree (host); - xfree (port); + free (protocol); + free (host); + free (port); return NULL; } ciptr->transptr = thistrans; ciptr->port = port; /* We need this for TRANS(Reopen) */ - xfree (protocol); - xfree (host); + free (protocol); + free (host); return ciptr; } @@ -859,16 +859,16 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address) { PRMSG (1,"Connect: Missing port specification in %s\n", address, 0, 0); - if (protocol) xfree (protocol); - if (host) xfree (host); + if (protocol) free (protocol); + if (host) free (host); return -1; } ret = ciptr->transptr->Connect (ciptr, host, port); - if (protocol) xfree (protocol); - if (host) xfree (host); - if (port) xfree (port); + if (protocol) free (protocol); + if (host) free (host); + if (port) free (port); return ret; } diff --git a/nx-X11/lib/xtrans/Xtransdnet.c b/nx-X11/lib/xtrans/Xtransdnet.c index a1728f187..34e191260 100644 --- a/nx-X11/lib/xtrans/Xtransdnet.c +++ b/nx-X11/lib/xtrans/Xtransdnet.c @@ -224,7 +224,7 @@ TRANS(DNETOpenCOTSServer) (Xtransport *thistrans, char *protocol, if ((ciptr->fd = socket (AF_DECnet, SOCK_STREAM, 0)) < 0) { - xfree ((char *) ciptr); + free ((char *) ciptr); return NULL; } @@ -406,7 +406,7 @@ TRANS(DNETAccept) (XtransConnInfo ciptr, int *status) { PRMSG (1, "DNETAccept: accept() failed\n", 0, 0, 0); - xfree (newciptr); + free (newciptr); *status = TRANS_ACCEPT_FAILED; return NULL; } @@ -421,7 +421,7 @@ TRANS(DNETAccept) (XtransConnInfo ciptr, int *status) PRMSG(1, "DNETAccept: ...DNETGetAddr() failed:\n", 0, 0, 0); close (newciptr->fd); - xfree (newciptr); + free (newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } @@ -432,8 +432,8 @@ TRANS(DNETAccept) (XtransConnInfo ciptr, int *status) "DNETAccept: ...DNETGetPeerAddr() failed:\n", 0, 0, 0); close (newciptr->fd); - if (newciptr->addr) xfree (newciptr->addr); - xfree (newciptr); + if (newciptr->addr) free (newciptr->addr); + free (newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } diff --git a/nx-X11/lib/xtrans/Xtranslcl.c b/nx-X11/lib/xtrans/Xtranslcl.c index 6165d3658..c1689c654 100644 --- a/nx-X11/lib/xtrans/Xtranslcl.c +++ b/nx-X11/lib/xtrans/Xtranslcl.c @@ -171,7 +171,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path) PRMSG(1, "FillAddrInfo: failed to allocate memory for peer addr\n", 0,0,0); - xfree ((char *) sunaddr); + free ((char *) sunaddr); ciptr->addr = NULL; return 0; @@ -610,7 +610,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) if( (sunaddr=(struct sockaddr_un *)xalloc(newciptr->peeraddrlen)) == NULL ) { PRMSG(1,"PTSAccept: failed to allocate memory for peer addr\n", 0,0,0); - xfree(newciptr->addr); + free(newciptr->addr); close(newfd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; @@ -834,7 +834,7 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) PRMSG(1, "NAMEDAccept: failed to allocate memory for peer addr\n", 0,0,0); - xfree(newciptr->addr); + free(newciptr->addr); close(str.fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; @@ -1178,7 +1178,7 @@ TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) PRMSG(1, "ISCAccept: failed to allocate memory for peer addr\n", 0,0,0); - xfree(newciptr->addr); + free(newciptr->addr); close(str.fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; @@ -1455,7 +1455,7 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) PRMSG(1, "SCOAccept: failed to allocate memory for peer addr\n", 0,0,0); - xfree(newciptr->addr); + free(newciptr->addr); close(fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; @@ -1913,7 +1913,7 @@ TRANS(LocalEndTransports)(void) { PRMSG(3,"LocalEndTransports()\n", 0,0,0 ); - xfree(freeXLOCAL); + free(freeXLOCAL); } #define TYPEBUFSIZE 32 @@ -2080,7 +2080,7 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port) if( ciptr->fd < 0 ) { - xfree(ciptr); + free(ciptr); return NULL; } @@ -2150,7 +2150,7 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port) } } - xfree(ciptr); + free(ciptr); return NULL; } @@ -2197,7 +2197,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port) return ciptr; } - xfree(ciptr); + free(ciptr); return NULL; } @@ -2396,7 +2396,7 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) if( newciptr->fd < 0 ) { - xfree(newciptr); + free(newciptr); return NULL; } diff --git a/nx-X11/lib/xtrans/Xtransos2.c b/nx-X11/lib/xtrans/Xtransos2.c index f4a6b036b..807a6029d 100644 --- a/nx-X11/lib/xtrans/Xtransos2.c +++ b/nx-X11/lib/xtrans/Xtransos2.c @@ -111,7 +111,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, 0,0,0 ); PRMSG(1,"\tor the DISPLAY variable is set incorrectly.\n", 0,0,0 ); - xfree(ciptr); + free(ciptr); return NULL; } try ++; @@ -133,7 +133,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, pipe_len=0; DosWrite(hServer,&pipe_len,1,&byteWritten); DosClose(hServer); - xfree(ciptr); + free(ciptr); return(NULL); } @@ -145,7 +145,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, PRMSG(1, "Os2OpenClient: Unable to connect to pipe %s\n", pipename,0,0 ); DosClose (hfd); DosClose(hServer); - xfree(ciptr); + free(ciptr); return (NULL); } @@ -158,7 +158,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, hServer,rc,byteWritten ); DosClose(hServer); DosClose(hfd); - xfree(ciptr); + free(ciptr); return(NULL); } @@ -182,7 +182,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, PRMSG(1, "\tor the XServer is too busy to respond.\n",0,0,0 ); DosClose(hServer); DosClose(hfd); - xfree(ciptr); + free(ciptr); return(NULL); } @@ -197,7 +197,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, PRMSG(1, "Os2OpenClient: Client pipe does not appear connected. rc=%d, h=%d\n",rc,hfd,0 ); PRMSG(1, "\tProbable cause: the XServer has just exited.\n",0,0,0 ); DosClose(hfd); - xfree(ciptr); + free(ciptr); return(NULL); } @@ -207,7 +207,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, PRMSG (1, "Os2OpenClient: Can't allocate space for the addr\n", 0, 0, 0); DosClose(hfd); - xfree(ciptr); + free(ciptr); return(NULL); } ciptr->addrlen = namelen; @@ -219,8 +219,8 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, PRMSG (1, "Os2OpenCLient: Can't allocate space for the addr\n", 0, 0, 0); DosClose(hfd); - xfree(ciptr->addr); - xfree(ciptr); + free(ciptr->addr); + free(ciptr); return(NULL); } ciptr->peeraddrlen = namelen; @@ -237,9 +237,9 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, PRMSG(1, "Os2OpenClient: Could not import the pipe handle into EMX\n",0,0,0 ); PRMSG(1, "\tProbable cause: EMX has run out of free file handles.\n",0,0,0 ); DosClose(hfd); - xfree(ciptr->addr); - xfree(ciptr->peeraddr); - xfree(ciptr); + free(ciptr->addr); + free(ciptr->peeraddr); + free(ciptr); return(NULL); } PRMSG(5, "Os2OpenClient: pipe handle %d EMX handle %d\n",ciptr->index,ciptr->fd,0 ); @@ -296,7 +296,7 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, PRMSG(1, "Os2OpenServer: Unable to create pipe %s, rc=%d\n", pipename,rc,0 ); PRMSG(1, "\tProbable cause: there is already another XServer running on display :%s\n",port,0,0 ); DosClose(hfd); - xfree(ciptr); + free(ciptr); return(NULL); } @@ -307,7 +307,7 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, { PRMSG(1, "Os2OpenServer: Unable to connect to pipe %s\n", pipename,0,0 ); DosClose (hfd); - xfree(ciptr); + free(ciptr); return (NULL); } @@ -321,7 +321,7 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, PRMSG (1, "Os2OpenServer: Can't allocate space for the addr\n", 0, 0, 0); DosClose(hfd); - xfree(ciptr); + free(ciptr); return(NULL); } ciptr->addrlen = namelen; @@ -333,8 +333,8 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, PRMSG (1, "Os2OpenServer: Can't allocate space for the addr\n", 0, 0, 0); DosClose(hfd); - xfree(ciptr->addr); - xfree(ciptr); + free(ciptr->addr); + free(ciptr); return(NULL); } @@ -351,9 +351,9 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, if((ciptr->fd=_imphandle(hfd))<0){ DosClose(hfd); - xfree(ciptr->addr); - xfree(ciptr->peeraddr); - xfree(ciptr); + free(ciptr->addr); + free(ciptr->peeraddr); + free(ciptr); return(NULL); } PRMSG(5, "Os2OpenServer: Pipe handle %d EMX handle %d",ciptr->index,ciptr->fd,0 ); @@ -365,9 +365,9 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, PRMSG(1, "Os2OpenCOTSServer: Could not attach sem %d to pipe %d, rc=%d\n", hPipeSem,ciptr->fd,rc); DosClose(ciptr->fd); - xfree(ciptr->addr); - xfree(ciptr->peeraddr); - xfree(ciptr); + free(ciptr->addr); + free(ciptr->peeraddr); + free(ciptr); return(NULL); } #endif @@ -445,7 +445,7 @@ TRANS(Os2ReopenCOTSServer)(Xtransport *thistrans, int fd, char *port) { PRMSG (1, "Os2ReopenCOTSServer: Can't allocate space for the addr\n", 0, 0, 0); - xfree(ciptr); + free(ciptr); return(NULL); } @@ -455,7 +455,7 @@ TRANS(Os2ReopenCOTSServer)(Xtransport *thistrans, int fd, char *port) { PRMSG (1, "Os2ReopenCOTSServer: Can't allocate space for the addr\n", 0, 0, 0); - xfree(ciptr); + free(ciptr); return(NULL); } @@ -521,7 +521,7 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) PRMSG(2,"Os2Accept: Error reading incoming connection, in=%d, error=%d\n", in,errno,0 ); *status = TRANS_ACCEPT_MISC_ERROR; - xfree(newciptr); + free(newciptr); rc = DosDisConnectNPipe(ciptr->fd); rc = DosConnectNPipe (ciptr->fd); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) @@ -540,7 +540,7 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) PRMSG(2,"Os2Accept: Error reading incoming connection, in=%d, error=%d\n", in,errno,0 ); *status = TRANS_ACCEPT_MISC_ERROR; - xfree(newciptr); + free(newciptr); rc = DosDisConnectNPipe(ciptr->fd); rc = DosConnectNPipe (ciptr->fd); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) @@ -566,7 +566,7 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) PRMSG(1,"Os2Accept: Open pipe %s to client failed, rc=%d\n", clientname,rc,0 ); PRMSG(1, "\tProbable cause: the client has exited or timed-out.\n",0,0,0 ); - xfree(newciptr); + free(newciptr); rc = DosDisConnectNPipe(ciptr->fd); rc = DosConnectNPipe (ciptr->fd); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) @@ -581,7 +581,7 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) { PRMSG(1,"Os2Accept: Could not set pipe %s to non-blocking mode, rc=%d\n", hClient,rc,0 ); - xfree(newciptr); + free(newciptr); rc = DosDisConnectNPipe(ciptr->fd); rc = DosConnectNPipe (ciptr->fd); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) @@ -610,7 +610,7 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) PRMSG (1, "Os2Accept: Can't allocate space for the addr\n", 0, 0, 0); DosClose(hClient); - xfree(newciptr); + free(newciptr); return(NULL); } @@ -623,8 +623,8 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) PRMSG (1, "Os2Accept: Can't allocate space for the addr\n", 0, 0, 0); DosClose(hClient); - xfree(ciptr->addr); - xfree(newciptr); + free(ciptr->addr); + free(newciptr); return(NULL); } @@ -643,9 +643,9 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) hClient,errno,0 ); PRMSG(1, "\tProbable cause: EMX has run out of file handles.\n",0,0,0 ); DosClose(hClient); - xfree(newciptr->addr); - xfree(newciptr->peeraddr); - xfree(newciptr); + free(newciptr->addr); + free(newciptr->peeraddr); + free(newciptr); return(NULL); } PRMSG(5, "Os2Accept: Pipe handle %d EMX handle %d",newciptr->index,newciptr->fd,0 ); @@ -657,9 +657,9 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) PRMSG(1, "Os2OpenCOTSServer: Could not attach sem %d to pipe %d, rc=%d\n", hPipeSem,newciptr->fd,rc); DosClose(newciptr->fd); - xfree(newciptr->addr); - xfree(newciptr->peeraddr); - xfree(newciptr); + free(newciptr->addr); + free(newciptr->peeraddr); + free(newciptr); return(NULL); } #endif diff --git a/nx-X11/lib/xtrans/Xtranssock.c b/nx-X11/lib/xtrans/Xtranssock.c index 5c57fc5ba..6a6600435 100644 --- a/nx-X11/lib/xtrans/Xtranssock.c +++ b/nx-X11/lib/xtrans/Xtranssock.c @@ -619,7 +619,7 @@ static XtransConnInfo TRANS(SocketCreateConnInfo) () if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) { PRMSG (1, "SocketCreateConnInfo: socketpair() failed.\n", 0, 0, 0); - xfree ((char *) ciptr); + free ((char *) ciptr); return NULL; } @@ -643,7 +643,7 @@ static XtransConnInfo TRANS(SocketCreateConnInfo) () { PRMSG (1, "SocketCreateConnInfo: No space for a new _NXProxyConnInfo for [%d].\n", ciptr->fd, 0, 0); - xfree ((char *) ciptr); + free ((char *) ciptr); return NULL; } else if (_NXProxyConnInfoTab[ciptr->fd] != NULL) @@ -658,7 +658,7 @@ static XtransConnInfo TRANS(SocketCreateConnInfo) () if (_NXProxyConnInfoTab[ciptr->fd] == NULL) { PRMSG (1, "SocketCreateConnInfo: Alloc of _NXProxyConnInfo failed.\n", 0, 0, 0); - xfree ((char *) ciptr); + free ((char *) ciptr); return NULL; } @@ -812,7 +812,7 @@ static void TRANS(SocketCloseConnInfo) (XtransConnInfo ciptr) ciptr->fd); #endif - xfree((char *) _NXProxyConnInfoTab[ciptr->fd]); + free((char *) _NXProxyConnInfoTab[ciptr->fd]); _NXProxyConnInfoTab[ciptr->fd] = NULL; @@ -1084,7 +1084,7 @@ TRANS(SocketOpen) (int i, int type) PRMSG (2, "SocketOpen: socket() failed for %s\n", Sockettrans2devtab[i].transname, 0, 0); - xfree ((char *) ciptr); + free ((char *) ciptr); return NULL; } @@ -1968,7 +1968,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) errno = WSAGetLastError(); #endif PRMSG (1, "SocketINETAccept: accept() failed\n", 0, 0, 0); - xfree (newciptr); + free (newciptr); *status = TRANS_ACCEPT_FAILED; return NULL; } @@ -1996,7 +1996,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) "SocketINETAccept: ...SocketINETGetAddr() failed:\n", 0, 0, 0); close (newciptr->fd); - xfree (newciptr); + free (newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } @@ -2007,8 +2007,8 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) "SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n", 0, 0, 0); close (newciptr->fd); - if (newciptr->addr) xfree (newciptr->addr); - xfree (newciptr); + if (newciptr->addr) free (newciptr->addr); + free (newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } @@ -2048,7 +2048,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) (struct sockaddr *) &sockname, (void *)&namelen)) < 0) { PRMSG (1, "SocketUNIXAccept: accept() failed\n", 0, 0, 0); - xfree (newciptr); + free (newciptr); *status = TRANS_ACCEPT_FAILED; return NULL; } @@ -2064,7 +2064,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) "SocketUNIXAccept: Can't allocate space for the addr\n", 0, 0, 0); close (newciptr->fd); - xfree (newciptr); + free (newciptr); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } @@ -2084,8 +2084,8 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) "SocketUNIXAccept: Can't allocate space for the addr\n", 0, 0, 0); close (newciptr->fd); - if (newciptr->addr) xfree (newciptr->addr); - xfree (newciptr); + if (newciptr->addr) free (newciptr->addr); + free (newciptr); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } @@ -2263,7 +2263,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) " socketfor IPv4 address\n", 0,0,0); } if (newciptr) - xfree(newciptr); + free(newciptr); } else { socketaddr = NULL; PRMSG (4,"SocketINETConnect Skipping IPv4 address\n", @@ -2301,7 +2301,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) "socket for IPv6 address\n", 0,0,0); } if (newciptr) - xfree(newciptr); + free(newciptr); } else { diff --git a/nx-X11/lib/xtrans/Xtranstli.c b/nx-X11/lib/xtrans/Xtranstli.c index d8b5db83b..ab37275dd 100644 --- a/nx-X11/lib/xtrans/Xtranstli.c +++ b/nx-X11/lib/xtrans/Xtranstli.c @@ -171,7 +171,7 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr) */ if( ciptr->addr ) - xfree(ciptr->addr); + free(ciptr->addr); if( (ciptr->addr=(char *)xalloc(netbuf.len)) == NULL ) { @@ -221,7 +221,7 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr) */ if( ciptr->peeraddr ) - xfree(ciptr->peeraddr); + free(ciptr->peeraddr); if( (ciptr->peeraddr=(char *)xalloc(netbuf.len)) == NULL ) { @@ -457,7 +457,7 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol, "TLIOpenCOTSClient: ...TLITLIBindLocal() failed: %d\n", errno, 0,0 ); t_close(ciptr->fd); - xfree(ciptr); + free(ciptr); return NULL; } @@ -467,7 +467,7 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol, "TLIOpenCOTSClient: ...TLIGetAddr() failed: %d\n", errno, 0,0 ); t_close(ciptr->fd); - xfree(ciptr); + free(ciptr); return NULL; } @@ -557,7 +557,7 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol, "TLIOpenCLTSClient: ...TLITLIBindLocal() failed: %d\n", errno, 0,0 ); t_close(ciptr->fd); - xfree(ciptr); + free(ciptr); return NULL; } @@ -567,7 +567,7 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol, "TLIOpenCLTSClient: ...TLIGetPeerAddr() failed: %d\n", errno, 0,0 ); t_close(ciptr->fd); - xfree(ciptr); + free(ciptr); return NULL; } @@ -917,7 +917,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status) errno, 0,0 ); t_free((char *)call,T_CALL); t_close(newciptr->fd); - xfree(newciptr); + free(newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } @@ -961,7 +961,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status) "TLIAccept: TRANS(TLIGetPeerAddr)() failed: %d\n", errno, 0,0 ); t_close(newciptr->fd); - xfree(newciptr); + free(newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } @@ -972,8 +972,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status) "TLIAccept: TRANS(TLIGetPeerAddr)() failed: %d\n", errno, 0,0 ); t_close(newciptr->fd); - xfree(newciptr->addr); - xfree(newciptr); + free(newciptr->addr); + free(newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } @@ -983,8 +983,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status) PRMSG(1, "TLIAccept() ioctl(I_POP, \"timod\") failed %d\n", errno,0,0 ); t_close(newciptr->fd); - xfree(newciptr->addr); - xfree(newciptr); + free(newciptr->addr); + free(newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } @@ -994,8 +994,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status) PRMSG(1, "TLIAccept() ioctl(I_PUSH,\"tirdwr\") failed %d\n", errno,0,0 ); t_close(newciptr->fd); - xfree(newciptr->addr); - xfree(newciptr); + free(newciptr->addr); + free(newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } diff --git a/nx-X11/lib/xtrans/Xtransutil.c b/nx-X11/lib/xtrans/Xtransutil.c index 20e431ac8..7dc91b16c 100644 --- a/nx-X11/lib/xtrans/Xtransutil.c +++ b/nx-X11/lib/xtrans/Xtransutil.c @@ -211,7 +211,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) if (len > 0) { if (*addrp && *addrlenp < (len + 1)) { - xfree ((char *) *addrp); + free ((char *) *addrp); *addrp = NULL; } if (!*addrp) @@ -226,7 +226,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) else { if (*addrp) - xfree ((char *) *addrp); + free ((char *) *addrp); *addrp = NULL; *addrlenp = 0; } diff --git a/nx-X11/lib/xtrans/transport.c b/nx-X11/lib/xtrans/transport.c index ff460c257..49441d76e 100644 --- a/nx-X11/lib/xtrans/transport.c +++ b/nx-X11/lib/xtrans/transport.c @@ -62,7 +62,6 @@ from The Open Group. #define xalloc(_size) malloc(_size) #define xcalloc(_num,_size) calloc(_num,_size) #define xrealloc(_ptr,_size) realloc(_ptr,_size) -#define xfree(_ptr) free(_ptr) #endif #include "Xtransint.h" -- cgit v1.2.3 From 2646fc254e75c4a7fc10d03d1139d0bd708ceae9 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 26 Jun 2016 01:51:18 +0200 Subject: nx-X11/programs/Xserver: Drop {X,x}alloc() macros, use malloc() instead. --- nx-X11/lib/xtrans/Xtrans.c | 20 ++++++++++---------- nx-X11/lib/xtrans/Xtransdnet.c | 4 ++-- nx-X11/lib/xtrans/Xtranslcl.c | 24 ++++++++++++------------ nx-X11/lib/xtrans/Xtransos2.c | 16 ++++++++-------- nx-X11/lib/xtrans/Xtranssock.c | 14 +++++++------- nx-X11/lib/xtrans/Xtranstli.c | 6 +++--- nx-X11/lib/xtrans/Xtransutil.c | 10 +++++----- nx-X11/lib/xtrans/transport.c | 1 - 8 files changed, 47 insertions(+), 48 deletions(-) (limited to 'nx-X11/lib') diff --git a/nx-X11/lib/xtrans/Xtrans.c b/nx-X11/lib/xtrans/Xtrans.c index f1e5ff966..934335269 100644 --- a/nx-X11/lib/xtrans/Xtrans.c +++ b/nx-X11/lib/xtrans/Xtrans.c @@ -221,7 +221,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) /* Copy the string so it can be changed */ - tmpptr = mybuf = (char *) xalloc (strlen (address) + 1); + tmpptr = mybuf = (char *) malloc (strlen (address) + 1); strcpy (mybuf, address); /* Parse the string to get each component */ @@ -362,7 +362,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) * string space for them. */ - if ((*protocol = (char *) xalloc(strlen (_protocol) + 1)) == NULL) + if ((*protocol = (char *) malloc(strlen (_protocol) + 1)) == NULL) { /* Malloc failed */ *port = NULL; @@ -374,7 +374,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) else strcpy (*protocol, _protocol); - if ((*host = (char *) xalloc (strlen (_host) + 1)) == NULL) + if ((*host = (char *) malloc (strlen (_host) + 1)) == NULL) { /* Malloc failed */ *port = NULL; @@ -387,7 +387,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) else strcpy (*host, _host); - if ((*port = (char *) xalloc (strlen (_port) + 1)) == NULL) + if ((*port = (char *) malloc (strlen (_port) + 1)) == NULL) { /* Malloc failed */ *port = NULL; @@ -539,7 +539,7 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port) return NULL; } - if ((save_port = (char *) xalloc (strlen (port) + 1)) == NULL) + if ((save_port = (char *) malloc (strlen (port) + 1)) == NULL) { PRMSG (1,"Reopen: Unable to malloc port string\n", 0, 0, 0); @@ -668,7 +668,7 @@ TRANS(GetReopenInfo) (XtransConnInfo ciptr, *trans_id = Xtransports[i].transport_id; *fd = ciptr->fd; - if ((*port = (char *) xalloc (strlen (ciptr->port) + 1)) == NULL) + if ((*port = (char *) malloc (strlen (ciptr->port) + 1)) == NULL) return 0; else { @@ -966,7 +966,7 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, *familyp = ciptr->family; *addrlenp = ciptr->addrlen; - if ((*addrp = (Xtransaddr *) xalloc (ciptr->addrlen)) == NULL) + if ((*addrp = (Xtransaddr *) malloc (ciptr->addrlen)) == NULL) { PRMSG (1,"GetMyAddr: malloc failed\n", 0, 0, 0); return -1; @@ -986,7 +986,7 @@ TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, *familyp = ciptr->family; *addrlenp = ciptr->peeraddrlen; - if ((*addrp = (Xtransaddr *) xalloc (ciptr->peeraddrlen)) == NULL) + if ((*addrp = (Xtransaddr *) malloc (ciptr->peeraddrlen)) == NULL) { PRMSG (1,"GetPeerAddr: malloc failed\n", 0, 0, 0); return -1; @@ -1141,7 +1141,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret, if (*count_ret > 0) { - if ((*ciptrs_ret = (XtransConnInfo *) xalloc ( + if ((*ciptrs_ret = (XtransConnInfo *) malloc ( *count_ret * sizeof (XtransConnInfo))) == NULL) { return -1; @@ -1239,7 +1239,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret, if (*count_ret > 0) { - if ((*ciptrs_ret = (XtransConnInfo *) xalloc ( + if ((*ciptrs_ret = (XtransConnInfo *) malloc ( *count_ret * sizeof (XtransConnInfo))) == NULL) { return -1; diff --git a/nx-X11/lib/xtrans/Xtransdnet.c b/nx-X11/lib/xtrans/Xtransdnet.c index 34e191260..161d48099 100644 --- a/nx-X11/lib/xtrans/Xtransdnet.c +++ b/nx-X11/lib/xtrans/Xtransdnet.c @@ -121,7 +121,7 @@ TRANS(DNETGetAddr) (XtransConnInfo ciptr) * Everything looks good: fill in the XtransConnInfo structure. */ - if ((ciptr->addr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->addr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "DNETGetAddr: Can't allocate space for the addr\n", 0, 0, 0); @@ -161,7 +161,7 @@ TRANS(DNETGetPeerAddr) (XtransConnInfo ciptr) * Everything looks good: fill in the XtransConnInfo structure. */ - if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->peeraddr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "DNETGetPeerAddr: Can't allocate space for the addr\n", diff --git a/nx-X11/lib/xtrans/Xtranslcl.c b/nx-X11/lib/xtrans/Xtranslcl.c index c1689c654..ebc8518ee 100644 --- a/nx-X11/lib/xtrans/Xtranslcl.c +++ b/nx-X11/lib/xtrans/Xtranslcl.c @@ -144,7 +144,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path) ciptr->family = AF_UNIX; ciptr->addrlen = sizeof (struct sockaddr_un); - if ((sunaddr = (struct sockaddr_un *) xalloc (ciptr->addrlen)) == NULL) + if ((sunaddr = (struct sockaddr_un *) malloc (ciptr->addrlen)) == NULL) { PRMSG(1,"FillAddrInfo: failed to allocate memory for addr\n", 0, 0, 0); return 0; @@ -165,7 +165,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path) ciptr->peeraddrlen = sizeof (struct sockaddr_un); - if ((p_sunaddr = (struct sockaddr_un *) xalloc ( + if ((p_sunaddr = (struct sockaddr_un *) malloc ( ciptr->peeraddrlen)) == NULL) { PRMSG(1, @@ -596,7 +596,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) */ newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) { + if( (newciptr->addr=(char *)malloc(newciptr->addrlen)) == NULL ) { PRMSG(1,"PTSAccept: failed to allocate memory for peer addr\n", 0,0,0); close(newfd); @@ -607,7 +607,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); newciptr->peeraddrlen=sizeof(struct sockaddr_un); - if( (sunaddr=(struct sockaddr_un *)xalloc(newciptr->peeraddrlen)) == NULL ) { + if( (sunaddr=(struct sockaddr_un *)malloc(newciptr->peeraddrlen)) == NULL ) { PRMSG(1,"PTSAccept: failed to allocate memory for peer addr\n", 0,0,0); free(newciptr->addr); @@ -818,7 +818,7 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) */ newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) { + if( (newciptr->addr=(char *)malloc(newciptr->addrlen)) == NULL ) { PRMSG(1, "NAMEDAccept: failed to allocate memory for peer addr\n", 0,0,0); @@ -830,7 +830,7 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); newciptr->peeraddrlen=newciptr->addrlen; - if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) { + if( (newciptr->peeraddr=(char *)malloc(newciptr->peeraddrlen)) == NULL ) { PRMSG(1, "NAMEDAccept: failed to allocate memory for peer addr\n", 0,0,0); @@ -1162,7 +1162,7 @@ TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) */ newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) { + if( (newciptr->addr=(char *)malloc(newciptr->addrlen)) == NULL ) { PRMSG(1, "ISCAccept: failed to allocate memory for peer addr\n", 0,0,0); @@ -1174,7 +1174,7 @@ TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); newciptr->peeraddrlen=newciptr->addrlen; - if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) { + if( (newciptr->peeraddr=(char *)malloc(newciptr->peeraddrlen)) == NULL ) { PRMSG(1, "ISCAccept: failed to allocate memory for peer addr\n", 0,0,0); @@ -1436,7 +1436,7 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) */ newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) { + if( (newciptr->addr=(char *)malloc(newciptr->addrlen)) == NULL ) { PRMSG(1, "SCOAccept: failed to allocate memory for peer addr\n", 0,0,0); @@ -1451,7 +1451,7 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) #endif newciptr->peeraddrlen=newciptr->addrlen; - if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) { + if( (newciptr->peeraddr=(char *)malloc(newciptr->peeraddrlen)) == NULL ) { PRMSG(1, "SCOAccept: failed to allocate memory for peer addr\n", 0,0,0); @@ -1894,7 +1894,7 @@ TRANS(LocalInitTransports)(char *protocol) if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") ) { - workingXLOCAL=freeXLOCAL=(char *)xalloc (strlen (protocol) + 1); + workingXLOCAL=freeXLOCAL=(char *)malloc (strlen (protocol) + 1); if (workingXLOCAL) strcpy (workingXLOCAL, protocol); } @@ -1902,7 +1902,7 @@ TRANS(LocalInitTransports)(char *protocol) XLOCAL=(char *)getenv("XLOCAL"); if(XLOCAL==NULL) XLOCAL=DEF_XLOCAL; - workingXLOCAL=freeXLOCAL=(char *)xalloc (strlen (XLOCAL) + 1); + workingXLOCAL=freeXLOCAL=(char *)malloc (strlen (XLOCAL) + 1); if (workingXLOCAL) strcpy (workingXLOCAL, XLOCAL); } diff --git a/nx-X11/lib/xtrans/Xtransos2.c b/nx-X11/lib/xtrans/Xtransos2.c index 807a6029d..9fd5049a0 100644 --- a/nx-X11/lib/xtrans/Xtransos2.c +++ b/nx-X11/lib/xtrans/Xtransos2.c @@ -202,7 +202,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, } namelen=sizeof(struct sockaddr); - if ((ciptr->addr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->addr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2OpenClient: Can't allocate space for the addr\n", 0, 0, 0); @@ -214,7 +214,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, ((struct sockaddr *)ciptr->addr)->sa_family = AF_UNIX; strcpy(((struct sockaddr *)ciptr->addr)->sa_data, "local"); - if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->peeraddr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2OpenCLient: Can't allocate space for the addr\n", 0, 0, 0); @@ -316,7 +316,7 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, /*** Put in info ***/ namelen=sizeof(struct sockaddr); - if ((ciptr->addr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->addr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2OpenServer: Can't allocate space for the addr\n", 0, 0, 0); @@ -328,7 +328,7 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, ((struct sockaddr *)ciptr->addr)->sa_family = AF_UNIX; strcpy (((struct sockaddr *)ciptr->addr)->sa_data, "local"); - if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->peeraddr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2OpenServer: Can't allocate space for the addr\n", 0, 0, 0); @@ -441,7 +441,7 @@ TRANS(Os2ReopenCOTSServer)(Xtransport *thistrans, int fd, char *port) strcpy(addr_name,"local"); namelen=sizeof(addr_name); - if ((ciptr->addr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->addr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2ReopenCOTSServer: Can't allocate space for the addr\n", 0, 0, 0); @@ -451,7 +451,7 @@ TRANS(Os2ReopenCOTSServer)(Xtransport *thistrans, int fd, char *port) ciptr->addrlen = namelen; memcpy (ciptr->addr, addr_name, ciptr->addrlen); - if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->peeraddr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2ReopenCOTSServer: Can't allocate space for the addr\n", 0, 0, 0); @@ -605,7 +605,7 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) /* And finally fill-in info in newciptr */ namelen=sizeof(struct sockaddr); - if ((newciptr->addr = (char *) xalloc (namelen)) == NULL) + if ((newciptr->addr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2Accept: Can't allocate space for the addr\n", 0, 0, 0); @@ -618,7 +618,7 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) ((struct sockaddr *)newciptr->addr)->sa_family = AF_UNIX; strcpy (((struct sockaddr *)newciptr->addr)->sa_data, "local"); - if ((newciptr->peeraddr = (char *) xalloc (namelen)) == NULL) + if ((newciptr->peeraddr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "Os2Accept: Can't allocate space for the addr\n", 0, 0, 0); diff --git a/nx-X11/lib/xtrans/Xtranssock.c b/nx-X11/lib/xtrans/Xtranssock.c index 6a6600435..79b95efdc 100644 --- a/nx-X11/lib/xtrans/Xtranssock.c +++ b/nx-X11/lib/xtrans/Xtranssock.c @@ -957,7 +957,7 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr) * Everything looks good: fill in the XtransConnInfo structure. */ - if ((ciptr->addr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->addr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "SocketINETGetAddr: Can't allocate space for the addr\n", @@ -1032,7 +1032,7 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr) * Everything looks good: fill in the XtransConnInfo structure. */ - if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->peeraddr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "SocketINETGetPeerAddr: Can't allocate space for the addr\n", @@ -1834,7 +1834,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port, namelen = sizeof (sockname); /* this will always make it the same size */ - if ((ciptr->addr = (char *) xalloc (namelen)) == NULL) + if ((ciptr->addr = (char *) malloc (namelen)) == NULL) { PRMSG (1, "SocketUNIXCreateListener: Can't allocate space for the addr\n", @@ -2058,7 +2058,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) * since this is unix domain. */ - if ((newciptr->addr = (char *) xalloc (ciptr->addrlen)) == NULL) + if ((newciptr->addr = (char *) malloc (ciptr->addrlen)) == NULL) { PRMSG (1, "SocketUNIXAccept: Can't allocate space for the addr\n", @@ -2078,7 +2078,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) newciptr->addrlen = ciptr->addrlen; memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen); - if ((newciptr->peeraddr = (char *) xalloc (ciptr->addrlen)) == NULL) + if ((newciptr->peeraddr = (char *) malloc (ciptr->addrlen)) == NULL) { PRMSG (1, "SocketUNIXAccept: Can't allocate space for the addr\n", @@ -2827,8 +2827,8 @@ SocketUNIXConnectPost: * since this is unix domain. */ - if ((ciptr->addr = (char *) xalloc(namelen)) == NULL || - (ciptr->peeraddr = (char *) xalloc(namelen)) == NULL) + if ((ciptr->addr = (char *) malloc(namelen)) == NULL || + (ciptr->peeraddr = (char *) malloc(namelen)) == NULL) { PRMSG (1, "SocketUNIXCreateListener: Can't allocate space for the addr\n", diff --git a/nx-X11/lib/xtrans/Xtranstli.c b/nx-X11/lib/xtrans/Xtranstli.c index ab37275dd..521f6a48c 100644 --- a/nx-X11/lib/xtrans/Xtranstli.c +++ b/nx-X11/lib/xtrans/Xtranstli.c @@ -173,7 +173,7 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr) if( ciptr->addr ) free(ciptr->addr); - if( (ciptr->addr=(char *)xalloc(netbuf.len)) == NULL ) + if( (ciptr->addr=(char *)malloc(netbuf.len)) == NULL ) { PRMSG(1, "TLIGetAddr: Can't allocate space for the addr\n", 0,0,0); @@ -223,7 +223,7 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr) if( ciptr->peeraddr ) free(ciptr->peeraddr); - if( (ciptr->peeraddr=(char *)xalloc(netbuf.len)) == NULL ) + if( (ciptr->peeraddr=(char *)malloc(netbuf.len)) == NULL ) { PRMSG(1, "TLIGetPeerAddr: Can't allocate space for the addr\n", @@ -730,7 +730,7 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req) * Everything looks good: fill in the XtransConnInfo structure. */ - if( (ciptr->addr=(char *)xalloc(ret->addr.len)) == NULL ) + if( (ciptr->addr=(char *)malloc(ret->addr.len)) == NULL ) { PRMSG(1, "TLICreateListener: Unable to allocate space for the address\n", diff --git a/nx-X11/lib/xtrans/Xtransutil.c b/nx-X11/lib/xtrans/Xtransutil.c index 7dc91b16c..cfe925edf 100644 --- a/nx-X11/lib/xtrans/Xtransutil.c +++ b/nx-X11/lib/xtrans/Xtransutil.c @@ -215,7 +215,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) *addrp = NULL; } if (!*addrp) - *addrp = (Xtransaddr *) xalloc (len + 1); + *addrp = (Xtransaddr *) malloc (len + 1); if (*addrp) { strcpy ((char *) *addrp, hostnamebuf); *addrlenp = len; @@ -262,7 +262,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) case AF_UNIX: { struct sockaddr_un *saddr = (struct sockaddr_un *) addr; - networkId = (char *) xalloc (3 + strlen (transName) + + networkId = (char *) malloc (3 + strlen (transName) + strlen (hostnamebuf) + strlen (saddr->sun_path)); sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, saddr->sun_path); @@ -292,7 +292,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) portnum = ntohs (saddr->sin_port); sprintf (portnumbuf, "%d", portnum); - networkId = (char *) xalloc (3 + strlen (transName) + + networkId = (char *) malloc (3 + strlen (transName) + strlen (hostnamebuf) + strlen (portnumbuf)); sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf); break; @@ -304,7 +304,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) { struct sockaddr_dn *saddr = (struct sockaddr_dn *) addr; - networkId = (char *) xalloc ( + networkId = (char *) malloc ( 13 + strlen (hostnamebuf) + saddr->sdn_objnamel); sprintf (networkId, "dnet/%s::%s", hostnamebuf, saddr->sdn_objname); @@ -453,7 +453,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) } - hostname = (char *) xalloc ( + hostname = (char *) malloc ( strlen (ciptr->transptr->TransName) + strlen (addr) + 2); strcpy (hostname, ciptr->transptr->TransName); strcat (hostname, "/"); diff --git a/nx-X11/lib/xtrans/transport.c b/nx-X11/lib/xtrans/transport.c index 49441d76e..8d3516dba 100644 --- a/nx-X11/lib/xtrans/transport.c +++ b/nx-X11/lib/xtrans/transport.c @@ -59,7 +59,6 @@ from The Open Group. #include "os.h" #else #include -#define xalloc(_size) malloc(_size) #define xcalloc(_num,_size) calloc(_num,_size) #define xrealloc(_ptr,_size) realloc(_ptr,_size) #endif -- cgit v1.2.3 From 74a5450bc058354e55c1589e64ef8e73775cebc4 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 26 Jun 2016 02:08:32 +0200 Subject: nx-X11/programs/Xserver: Drop {X,x}realloc() macros, use realloc() instead. --- nx-X11/lib/xtrans/transport.c | 1 - 1 file changed, 1 deletion(-) (limited to 'nx-X11/lib') diff --git a/nx-X11/lib/xtrans/transport.c b/nx-X11/lib/xtrans/transport.c index 8d3516dba..b7b1ef496 100644 --- a/nx-X11/lib/xtrans/transport.c +++ b/nx-X11/lib/xtrans/transport.c @@ -60,7 +60,6 @@ from The Open Group. #else #include #define xcalloc(_num,_size) calloc(_num,_size) -#define xrealloc(_ptr,_size) realloc(_ptr,_size) #endif #include "Xtransint.h" -- cgit v1.2.3 From ce40aec08aef6aebd1d25728a1d0dc4b2bc8db09 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 27 Jun 2016 11:51:31 +0200 Subject: nx-X11/programs/Xserver: Drop {X,x}calloc() macros, use calloc() instead. --- nx-X11/lib/xtrans/Xtransdnet.c | 12 ++++++------ nx-X11/lib/xtrans/Xtranslcl.c | 8 ++++---- nx-X11/lib/xtrans/Xtransos2.c | 14 +++++++------- nx-X11/lib/xtrans/Xtranssock.c | 12 ++++++------ nx-X11/lib/xtrans/Xtranstli.c | 4 ++-- nx-X11/lib/xtrans/transport.c | 1 - 6 files changed, 25 insertions(+), 26 deletions(-) (limited to 'nx-X11/lib') diff --git a/nx-X11/lib/xtrans/Xtransdnet.c b/nx-X11/lib/xtrans/Xtransdnet.c index 161d48099..00a086277 100644 --- a/nx-X11/lib/xtrans/Xtransdnet.c +++ b/nx-X11/lib/xtrans/Xtransdnet.c @@ -187,7 +187,7 @@ TRANS(DNETOpenCOTSClient) (Xtransport *thistrans, char *protocol, PRMSG (2,"DNETOpenCOTSClient(%s,%s,%s)\n", protocol, host, port); - if ((ciptr = (XtransConnInfo) xcalloc ( + if ((ciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "DNETOpenCOTSClient: malloc failed\n", 0, 0, 0); @@ -215,7 +215,7 @@ TRANS(DNETOpenCOTSServer) (Xtransport *thistrans, char *protocol, PRMSG (2,"DNETOpenCOTSServer(%s,%s,%s)\n", protocol, host, port); - if ((ciptr = (XtransConnInfo) xcalloc ( + if ((ciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "DNETOpenCOTSServer: malloc failed\n", 0, 0, 0); @@ -247,7 +247,7 @@ TRANS(DNETOpenCLTSClient) (Xtransport *thistrans, char *protocol, PRMSG (2,"DNETOpenCLTSClient(%s,%s,%s)\n", protocol, host, port); - if ((ciptr = (XtransConnInfo) xcalloc ( + if ((ciptr = (XtransConnInfo) calloc ( 1, sizeof (struct _XtransConnInfo))) == NULL) { PRMSG (1, "DNETOpenCLTSClient: malloc failed\n", 0, 0, 0); @@ -290,7 +290,7 @@ TRANS(DNETReopenCOTSServer) (Xtransport *thistrans, int fd, char *port) PRMSG (2,"DNETReopenCOTSServer(%d,%s)\n", fd, port, 0); - if ((ciptr = (XtransConnInfo) xcalloc ( + if ((ciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "DNETReopenCOTSServer: malloc failed\n", 0, 0, 0); @@ -311,7 +311,7 @@ TRANS(DNETReopenCLTSServer) (Xtransport *thistrans, int fd, char *port) PRMSG (2,"DNETReopenCLTSServer(%d,%s)\n", fd, port, 0); - if ((ciptr = (XtransConnInfo) xcalloc ( + if ((ciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "DNETReopenCLTSServer: malloc failed\n", 0, 0, 0); @@ -393,7 +393,7 @@ TRANS(DNETAccept) (XtransConnInfo ciptr, int *status) PRMSG (2, "DNETAccept(%x,%d)\n", ciptr, ciptr->fd, 0); - if ((newciptr = (XtransConnInfo) xcalloc( + if ((newciptr = (XtransConnInfo) calloc( 1, sizeof (struct _XtransConnInfo))) == NULL) { PRMSG (1, "DNETAccept: malloc failed\n", 0, 0, 0); diff --git a/nx-X11/lib/xtrans/Xtranslcl.c b/nx-X11/lib/xtrans/Xtranslcl.c index ebc8518ee..52e845124 100644 --- a/nx-X11/lib/xtrans/Xtranslcl.c +++ b/nx-X11/lib/xtrans/Xtranslcl.c @@ -2038,7 +2038,7 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port) */ #endif /* X11_t */ - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { PRMSG(1,"LocalOpenClient: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); @@ -2113,7 +2113,7 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port) */ #endif /* X11_t */ - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { PRMSG(1,"LocalOpenServer: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); @@ -2168,7 +2168,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port) PRMSG(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd); - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { PRMSG(1,"LocalReopenServer: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); @@ -2384,7 +2384,7 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) transptr=(LOCALtrans2dev *)ciptr->priv; - if( (newciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo)))==NULL ) + if( (newciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo)))==NULL ) { PRMSG(1,"LocalAccept: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); diff --git a/nx-X11/lib/xtrans/Xtransos2.c b/nx-X11/lib/xtrans/Xtransos2.c index 9fd5049a0..1380403da 100644 --- a/nx-X11/lib/xtrans/Xtransos2.c +++ b/nx-X11/lib/xtrans/Xtransos2.c @@ -90,7 +90,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol, PRMSG(5, "Os2OpenClient: Creating pipe %s\n",pipename, 0,0 ); /* make a connection entry */ - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { PRMSG(1,"Os2OpenClient: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); return NULL; @@ -268,9 +268,9 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol, PRMSG(2,"Os2OpenServer(%s,%s,%s)\n",protocol,host,port); - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { - PRMSG(1,"Os2OpenServer: xcalloc(1,%d) failed\n", + PRMSG(1,"Os2OpenServer: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); return NULL; } @@ -432,9 +432,9 @@ TRANS(Os2ReopenCOTSServer)(Xtransport *thistrans, int fd, char *port) PRMSG(2,"Os2ReopenCOTSServer(%d,%s)\n", fd, port, 0); - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { - PRMSG(1,"Os2ReopenCOTSServer: xcalloc(1,%d) failed\n", + PRMSG(1,"Os2ReopenCOTSServer: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); return NULL; } @@ -508,9 +508,9 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status) PRMSG(2,"Os2Accept(%x->%d)\n", ciptr, ciptr->fd,0); - if( (newciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo)))==NULL ) + if( (newciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo)))==NULL ) { - PRMSG(1,"Os2Accept: xcalloc(1,%d) failed\n", + PRMSG(1,"Os2Accept: calloc(1,%d) failed\n", sizeof(struct _XtransConnInfo),0,0 ); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; diff --git a/nx-X11/lib/xtrans/Xtranssock.c b/nx-X11/lib/xtrans/Xtranssock.c index 79b95efdc..e27ba9993 100644 --- a/nx-X11/lib/xtrans/Xtranssock.c +++ b/nx-X11/lib/xtrans/Xtranssock.c @@ -601,7 +601,7 @@ static XtransConnInfo TRANS(SocketCreateConnInfo) () fprintf(stderr, "SocketCreateConnInfo: Going to create the NX connection info.\n"); #endif - if ((ciptr = (XtransConnInfo) xcalloc (1, sizeof(struct _XtransConnInfo))) == NULL) + if ((ciptr = (XtransConnInfo) calloc (1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "SocketCreateConnInfo: malloc failed\n", 0, 0, 0); return NULL; @@ -653,7 +653,7 @@ static XtransConnInfo TRANS(SocketCreateConnInfo) () exit(1); } - _NXProxyConnInfoTab[ciptr->fd] = (_NXProxyConnInfo *) xcalloc(1, sizeof(_NXProxyConnInfo)); + _NXProxyConnInfoTab[ciptr->fd] = (_NXProxyConnInfo *) calloc(1, sizeof(_NXProxyConnInfo)); if (_NXProxyConnInfoTab[ciptr->fd] == NULL) { @@ -1063,7 +1063,7 @@ TRANS(SocketOpen) (int i, int type) return NULL; #endif - if ((ciptr = (XtransConnInfo) xcalloc ( + if ((ciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "SocketOpen: malloc failed\n", 0, 0, 0); @@ -1119,7 +1119,7 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port) PRMSG (3,"SocketReopen(%d,%d,%s)\n", type, fd, port); - if ((ciptr = (XtransConnInfo) xcalloc ( + if ((ciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "SocketReopen: malloc failed\n", 0, 0, 0); @@ -1953,7 +1953,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) PRMSG (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd, 0); - if ((newciptr = (XtransConnInfo) xcalloc ( + if ((newciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "SocketINETAccept: malloc failed\n", 0, 0, 0); @@ -2036,7 +2036,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) PRMSG (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd, 0); - if ((newciptr = (XtransConnInfo) xcalloc ( + if ((newciptr = (XtransConnInfo) calloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { PRMSG (1, "SocketUNIXAccept: malloc() failed\n", 0, 0, 0); diff --git a/nx-X11/lib/xtrans/Xtranstli.c b/nx-X11/lib/xtrans/Xtranstli.c index 521f6a48c..cab8da79f 100644 --- a/nx-X11/lib/xtrans/Xtranstli.c +++ b/nx-X11/lib/xtrans/Xtranstli.c @@ -320,7 +320,7 @@ TRANS(TLIOpen)(char *device) PRMSG(3,"TLIOpen(%s)\n", device, 0,0 ); - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { PRMSG(1, "TLIOpen: calloc failed\n", 0,0,0 ); return NULL; @@ -353,7 +353,7 @@ TRANS(TLIReopen)(char *device, int fd, char *port) return NULL; } - if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { PRMSG(1, "TLIReopen: calloc failed\n", 0,0,0 ); return NULL; diff --git a/nx-X11/lib/xtrans/transport.c b/nx-X11/lib/xtrans/transport.c index b7b1ef496..36de15e34 100644 --- a/nx-X11/lib/xtrans/transport.c +++ b/nx-X11/lib/xtrans/transport.c @@ -59,7 +59,6 @@ from The Open Group. #include "os.h" #else #include -#define xcalloc(_num,_size) calloc(_num,_size) #endif #include "Xtransint.h" -- cgit v1.2.3