[Spice-devel] [spice-server v3 10/10] sound: Convert SndChannelClient to RedChannelClient

Christophe Fergeau cfergeau at redhat.com
Mon Jan 30 12:37:00 UTC 2017


On Mon, Jan 30, 2017 at 07:02:04AM -0500, Frediano Ziglio wrote:
> 
> > 
> > Fwiw, see the merged patch attached to this mail. Frediano feels
> > strongly that these should be merged, so I'll most likely go with this
> > version.
> > 
> > Christophe
> > 
> 
> I noted this weird hunk (that don't apply on top of previous series
> without last 2 patches):
> 
> @@ -645,9 +575,9 @@ static void snd_send(SndChannelClient * client)
>  {
>      RedChannelClient *rcc;
> 
> -    g_return_if_fail(client != NULL);
> +    g_return_if_fail(RED_IS_CHANNEL_CLIENT(client));
> 
> -    rcc = client->channel_client;
> +    rcc = RED_CHANNEL_CLIENT(client);
>      if (!red_channel_client_pipe_is_empty(rcc) || !client->command) {
>          return;
>      }
> 
> 
> I think would be better:
> 
>      RedChannelClient *rcc;
> 
>      rcc = RED_CHANNEL_CLIENT(client);
>      if (!rcc || !red_channel_client_pipe_is_empty(rcc) || !client->command) {
>          return;
>      }
> 
> no reason to check for type twice, RED_CHANNEL_CLIENT handle NULL cases with
> warning if needed.
> 
> Or just remove the check at all...

I *think* this can never be called with a NULL pointer, but I'm not 100%
sure, so I prefer to have a loud warning and no crash for now if we are
called with a NULL client.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170130/29f6eece/attachment.sig>


More information about the Spice-devel mailing list