[Spice-devel] [spice-server v3 07/10] sound: Use RedChannelClient to receive/send data
Christophe Fergeau
cfergeau at redhat.com
Thu Jan 26 13:33:05 UTC 2017
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
-------------- 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/20170126/70797fd0/attachment.sig>
More information about the Spice-devel
mailing list