[PATCH 21/22] os: Use local variable to hold pointer to OsCommPtr

Alan Coopersmith alan.coopersmith at oracle.com
Wed Dec 29 15:04:25 PST 2010


On 12/29/10 11:27 AM, Pauli wrote:
> From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> 
> Local variable eliminates some casts to OsCommPtr.
> 
> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> ---
>  os/access.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/os/access.c b/os/access.c
> index 494986e..3fc5896 100644
> --- a/os/access.c
> +++ b/os/access.c
> @@ -1034,13 +1034,15 @@ Bool LocalClient(ClientPtr client)
>      Xtransaddr		*from = NULL;
>      pointer		addr;
>      register HOST	*host;
> +    OsCommPtr		oc;
>  
>      if (!client->osPrivate)
>          return FALSE;
> -    if (!((OsCommPtr)client->osPrivate)->trans_conn)
> +    oc = client->osPrivate;
> +    if (!oc->trans_conn)
>          return FALSE;
>  
> -    if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
> +    if (!_XSERVTransGetPeerAddr (oc->trans_conn,
>  	&notused, &alen, &from))
>      {
>  	family = ConvertAddr ((struct sockaddr *) from,

Conceptually, looks reasonable to me, so
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

But stylistically I'd probably merge the lines now that they're short enough
to fit in one line:

-    if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
-	&notused, &alen, &from))
+    if (!_XSERVTransGetPeerAddr (oc->trans_conn, &notused, &alen, &from))

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list