aboutsummaryrefslogtreecommitdiff
path: root/X11/xtrans/Xtrans.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-12-12 12:23:04 +0100
committermarha <marha@users.sourceforge.net>2011-12-12 12:23:04 +0100
commit5efb0a5e19b75137b7294b27f4e7878aeb8f0927 (patch)
treea8138a3cf2f3ed5beacd1ce9e44dda79b51f9ffd /X11/xtrans/Xtrans.c
parent5b178ff5a5f0b6e481cf9fd9749eb7ef9581c987 (diff)
downloadvcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.tar.gz
vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.tar.bz2
vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.zip
libxtrans libX11 libxcb xserver mesa git update 12 dec 2011
Diffstat (limited to 'X11/xtrans/Xtrans.c')
-rw-r--r--X11/xtrans/Xtrans.c87
1 files changed, 38 insertions, 49 deletions
diff --git a/X11/xtrans/Xtrans.c b/X11/xtrans/Xtrans.c
index 522e543c4..54e3bdca7 100644
--- a/X11/xtrans/Xtrans.c
+++ b/X11/xtrans/Xtrans.c
@@ -135,15 +135,15 @@ TRANS(FreeConnInfo) (XtransConnInfo ciptr)
prmsg (3,"FreeConnInfo(%p)\n", ciptr);
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 (ciptr);
}
@@ -212,8 +212,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);
- strcpy (mybuf, address);
+ tmpptr = mybuf = strdup (address);
/* Parse the string to get each component */
@@ -229,7 +228,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*protocol = NULL;
*host = NULL;
*port = NULL;
- xfree (tmpptr);
+ free (tmpptr);
return 0;
}
@@ -279,7 +278,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*protocol = NULL;
*host = NULL;
*port = NULL;
- xfree (tmpptr);
+ free (tmpptr);
return 0;
}
@@ -346,46 +345,40 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
* string space for them.
*/
- if ((*protocol = (char *) xalloc(strlen (_protocol) + 1)) == NULL)
+ if ((*protocol = strdup (_protocol)) == NULL)
{
/* Malloc failed */
*port = NULL;
*host = NULL;
*protocol = NULL;
- xfree (tmpptr);
+ free (tmpptr);
return 0;
}
- else
- strcpy (*protocol, _protocol);
- if ((*host = (char *) xalloc (strlen (_host) + 1)) == NULL)
+ if ((*host = strdup (_host)) == NULL)
{
/* Malloc failed */
*port = NULL;
*host = NULL;
- xfree (*protocol);
+ free (*protocol);
*protocol = NULL;
- xfree (tmpptr);
+ free (tmpptr);
return 0;
- }
- else
- strcpy (*host, _host);
+ }
- if ((*port = (char *) xalloc (strlen (_port) + 1)) == NULL)
+ if ((*port = strdup (_port)) == NULL)
{
/* 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;
}
@@ -430,9 +423,9 @@ TRANS(Open) (int type, char *address)
prmsg (1,"Open: Unable to find transport for %s\n",
protocol);
- xfree (protocol);
- xfree (host);
- xfree (port);
+ free (protocol);
+ free (host);
+ free (port);
return NULL;
}
@@ -471,17 +464,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;
}
@@ -523,15 +516,13 @@ 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 = strdup (port)) == NULL)
{
prmsg (1,"Reopen: Unable to malloc port string\n");
return NULL;
}
- strcpy (save_port, port);
-
/* Get a new XtransConnInfo object */
switch (type)
@@ -549,6 +540,7 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
if (ciptr == NULL)
{
prmsg (1,"Reopen: transport open failed\n");
+ free (save_port);
return NULL;
}
@@ -652,13 +644,10 @@ TRANS(GetReopenInfo) (XtransConnInfo ciptr,
*trans_id = Xtransports[i].transport_id;
*fd = ciptr->fd;
- if ((*port = (char *) xalloc (strlen (ciptr->port) + 1)) == NULL)
+ if ((*port = strdup (ciptr->port)) == NULL)
return 0;
else
- {
- strcpy (*port, ciptr->port);
return 1;
- }
}
return 0;
@@ -843,16 +832,16 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
{
prmsg (1,"Connect: Missing port specification in %s\n",
address);
- 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;
}
@@ -950,7 +939,7 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
*familyp = ciptr->family;
*addrlenp = ciptr->addrlen;
- if ((*addrp = (Xtransaddr *) xalloc (ciptr->addrlen)) == NULL)
+ if ((*addrp = malloc (ciptr->addrlen)) == NULL)
{
prmsg (1,"GetMyAddr: malloc failed\n");
return -1;
@@ -970,7 +959,7 @@ TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
*familyp = ciptr->family;
*addrlenp = ciptr->peeraddrlen;
- if ((*addrp = (Xtransaddr *) xalloc (ciptr->peeraddrlen)) == NULL)
+ if ((*addrp = malloc (ciptr->peeraddrlen)) == NULL)
{
prmsg (1,"GetPeerAddr: malloc failed\n");
return -1;
@@ -1139,7 +1128,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
if (*count_ret > 0)
{
- if ((*ciptrs_ret = (XtransConnInfo *) xalloc (
+ if ((*ciptrs_ret = malloc (
*count_ret * sizeof (XtransConnInfo))) == NULL)
{
return -1;
@@ -1237,7 +1226,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
if (*count_ret > 0)
{
- if ((*ciptrs_ret = (XtransConnInfo *) xalloc (
+ if ((*ciptrs_ret = malloc (
*count_ret * sizeof (XtransConnInfo))) == NULL)
{
return -1;