[PATCH:libxtrans 3/4] Remove unnecessary casts on malloc, calloc & free calls

Mark Kettenis mark.kettenis at xs4all.nl
Tue Dec 6 02:28:31 PST 2011


> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> Date: Mon,  5 Dec 2011 20:36:31 -0800

Minor nit; see below.

Reviewed-by: Mark Kettenis <kettenis at openbsd.org>

> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  Xtrans.c     |   10 +++++-----
>  Xtranslcl.c  |   26 +++++++++++++-------------
>  Xtranssock.c |   32 ++++++++++++++------------------
>  Xtranstli.c  |   10 +++++-----
>  Xtransutil.c |   13 ++++++-------
>  5 files changed, 43 insertions(+), 48 deletions(-)

> diff --git a/Xtranslcl.c b/Xtranslcl.c
> index 925ba01..2d0bdd5 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 *) malloc (ciptr->addrlen)) == NULL)
> +    if ((sunaddr = malloc (ciptr->addrlen)) == NULL)
>      {
>  	prmsg(1,"FillAddrInfo: failed to allocate memory for addr\n");
>  	return 0;
> @@ -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 *) malloc (
> +    if ((p_sunaddr = malloc (
>  	ciptr->peeraddrlen)) == NULL)

This one should fit on a single line now isn't it?



More information about the xorg-devel mailing list