diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-30 18:05:05 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-05 20:34:28 -0800 |
commit | b89e1b45198c48996750b5da3d715c10f974243f (patch) | |
tree | 7091bd01c843ccaffbff8b06afe91dea4fd8986f /Xtranslcl.c | |
parent | ff992be7b05483f9a0586a27ee0edb6d99580b84 (diff) |
Finish conversion to standard C allocation functions
Commit 4ac40cd5451 started this, by no longer special casing the
xserver to include it's former custom allocation functions, this
just takes the remaining #defines and pre-substitutes them into
the code.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'Xtranslcl.c')
-rw-r--r-- | Xtranslcl.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Xtranslcl.c b/Xtranslcl.c index 8466ddc..8a5e718 100644 --- a/Xtranslcl.c +++ b/Xtranslcl.c @@ -152,7 +152,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"); return 0; @@ -162,7 +162,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path) if (strlen(sun_path) > sizeof(sunaddr->sun_path) - 1) { prmsg(1, "FillAddrInfo: path too long\n"); - xfree((char *) sunaddr); + free((char *) sunaddr); return 0; } strcpy (sunaddr->sun_path, sun_path); @@ -174,12 +174,12 @@ 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, "FillAddrInfo: failed to allocate memory for peer addr\n"); - xfree ((char *) sunaddr); + free ((char *) sunaddr); ciptr->addr = NULL; return 0; @@ -189,7 +189,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path) if (strlen(peer_sun_path) > sizeof(p_sunaddr->sun_path) - 1) { prmsg(1, "FillAddrInfo: peer path too long\n"); - xfree((char *) p_sunaddr); + free((char *) p_sunaddr); return 0; } strcpy (p_sunaddr->sun_path, peer_sun_path); @@ -613,7 +613,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"); close(newfd); *status = TRANS_ACCEPT_BAD_MALLOC; @@ -623,9 +623,9 @@ 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"); - xfree(newciptr->addr); + free(newciptr->addr); close(newfd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; @@ -885,7 +885,7 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) */ newciptr->family=ciptr->family; 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 pipe addr\n"); close(str.fd); @@ -896,10 +896,10 @@ 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"); - xfree(newciptr->addr); + free(newciptr->addr); close(str.fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; @@ -1223,7 +1223,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"); close(fd); @@ -1237,10 +1237,10 @@ 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"); - xfree(newciptr->addr); + free(newciptr->addr); close(fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; @@ -1671,7 +1671,7 @@ TRANS(LocalInitTransports)(const 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); } @@ -1679,7 +1679,7 @@ TRANS(LocalInitTransports)(const 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); } @@ -1690,7 +1690,7 @@ TRANS(LocalEndTransports)(void) { prmsg(3,"LocalEndTransports()\n"); - xfree(freeXLOCAL); + free(freeXLOCAL); } #define TYPEBUFSIZE 32 @@ -1815,7 +1815,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,%lu) failed\n", sizeof(struct _XtransConnInfo)); @@ -1856,7 +1856,7 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port) if( ciptr->fd < 0 ) { - xfree(ciptr); + free(ciptr); return NULL; } @@ -1889,7 +1889,7 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *por */ #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,%lu) failed\n", sizeof(struct _XtransConnInfo)); @@ -1925,7 +1925,7 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *por } } - xfree(ciptr); + free(ciptr); return NULL; } @@ -1943,7 +1943,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,%lu) failed\n", sizeof(struct _XtransConnInfo)); @@ -1972,7 +1972,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port) return ciptr; } - xfree(ciptr); + free(ciptr); return NULL; } @@ -2175,7 +2175,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,%lu) failed\n", sizeof(struct _XtransConnInfo)); @@ -2187,7 +2187,7 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) if( newciptr->fd < 0 ) { - xfree(newciptr); + free(newciptr); return NULL; } |