Re: [spice-server v3 07/10] sound: Use RedChannelClient to receive/send data

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

 



On Thu, Jan 26, 2017 at 07:34:05AM -0500, Frediano Ziglio wrote:
> > +static void snd_persistent_pipe_item_free(struct RedPipeItem *item)
> > +{
> > +    SndChannelClient *client = SPICE_CONTAINEROF(item, SndChannelClient,
> > persistent_pipe_item);
> > +
> > +    red_pipe_item_init_full(item, RED_PIPE_ITEM_PERSISTENT,
> > +                            snd_persistent_pipe_item_free);
> > +
> > +    if (client->on_message_done) {
> > +        client->on_message_done(client);
> > +    }
> > +}
> > +
> > +static void snd_send(SndChannelClient * client)
> > +{
> > +    RedChannelClient *rcc = client->channel_client;
> > +
> > +    if (!client || !red_channel_client_pipe_is_empty(rcc) ||
> > !client->command) {
> 
> the !client check here is useless after its use

I've changed this part to

@@ -715,10 +715,12 @@ static void snd_send(SndChannelClient * client)
 {
     RedChannelClient *rcc;

-    if (!client || !red_channel_client_pipe_is_empty(rcc) || !client->command) {
-        return;
-    }
+    g_return_if_fail(client != NULL);
+
     rcc = client->channel_client;
+    if (!red_channel_client_pipe_is_empty(rcc) || !client->command) {
+        return;
+    }
     // just append a dummy item and push!
     red_pipe_item_init_full(&client->persistent_pipe_item, RED_PIPE_ITEM_PERSISTENT,
                             snd_persistent_pipe_item_free);

(not 100% sure 'client' cannot be NULL here, so we might have to silence this if
this triggers during testing).

Christophe

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]