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
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/spice-devel
