Re: [PATCH spice-server] spicevmc: Remove useless check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 03, 2017 at 10:49:58AM +0100, Frediano Ziglio wrote:
> rcc is already deferenced in red_channel_client_get_client so
> checking for NULL after that is uselss.

Why is this the right fix rather than this: ?

RedClient *client;
if (!rcc) return; /* or g_return_if_fail(RED_IS_CLIENT_CHANNEL(rcc)); */
client = red_channel_client_get_client(rcc);

I'm not saying one is better than the others, just that I'd expect an
explanation in the commit log saying why it's fine to assume rcc is
never going to be NULL.

Christophe

> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/spicevmc.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> Don't actually remember if I posted already this patch or
> a similar one.
> 
> diff --git a/server/spicevmc.c b/server/spicevmc.c
> index 83f4a76..34d5c6e 100644
> --- a/server/spicevmc.c
> +++ b/server/spicevmc.c
> @@ -482,10 +482,6 @@ static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
>      SpiceCharDeviceInterface *sif;
>      RedClient *client = red_channel_client_get_client(rcc);
>  
> -    if (!rcc) {
> -        return;
> -    }
> -
>      channel = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
>  
>      /* partial message which wasn't pushed to device */
> -- 
> 2.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]