diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-30 18:40:46 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-06 11:18:07 -0800 |
commit | a04a45cb94f7f569e6dd77df93258fa167d0a4ea (patch) | |
tree | 449089b4192273a91703035c5c62ead005788a66 /Xtransutil.c | |
parent | a0bfb4fefd20b396e3d88eff0c60602fc436dad5 (diff) |
Remove unnecessary casts on malloc, calloc & free calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Diffstat (limited to 'Xtransutil.c')
-rw-r--r-- | Xtransutil.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Xtransutil.c b/Xtransutil.c index 4128990..52c937b 100644 --- a/Xtransutil.c +++ b/Xtransutil.c @@ -197,11 +197,11 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) if (len > 0) { if (*addrp && *addrlenp < (len + 1)) { - free ((char *) *addrp); + free (*addrp); *addrp = NULL; } if (!*addrp) - *addrp = (Xtransaddr *) malloc (len + 1); + *addrp = malloc (len + 1); if (*addrp) { strcpy ((char *) *addrp, hostnamebuf); *addrlenp = len; @@ -212,7 +212,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) else { if (*addrp) - free ((char *) *addrp); + free (*addrp); *addrp = NULL; *addrlenp = 0; } @@ -255,7 +255,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) case AF_UNIX: { struct sockaddr_un *saddr = (struct sockaddr_un *) addr; - networkId = (char *) malloc (3 + strlen (transName) + + networkId = malloc (3 + strlen (transName) + strlen (hostnamebuf) + strlen (saddr->sun_path)); sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, saddr->sun_path); @@ -285,7 +285,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) portnum = ntohs (saddr->sin_port); snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum); - networkId = (char *) malloc (3 + strlen (transName) + + networkId = malloc (3 + strlen (transName) + strlen (hostnamebuf) + strlen (portnumbuf)); sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf); break; @@ -418,8 +418,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) } - hostname = (char *) malloc ( - strlen (ciptr->transptr->TransName) + strlen (addr) + 2); + hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2); strcpy (hostname, ciptr->transptr->TransName); strcat (hostname, "/"); if (addr) |