[Spice-devel] [PATCH server v2 07/13] channel: do not call pipe_add with null items

Frediano Ziglio fziglio at redhat.com
Fri Jan 15 02:52:38 PST 2016


> 
> If the creator was not able to produce the item, no need to call
> pipe_add().
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> ---
>  server/red-channel.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/server/red-channel.c b/server/red-channel.c
> index 7296820..ceceb7f 100644
> --- a/server/red-channel.c
> +++ b/server/red-channel.c
> @@ -2245,7 +2245,7 @@ typedef int (*rcc_item_cond_t)(RedChannelClient *rcc,
> PipeItem *item);
>   * @channel: a channel
>   * @creator: a callback to create pipe item (not null)
>   * @data: the data to pass to the creator
> - * @pipe_add: a callback to add pipe items (not null)
> + * @pipe_add: a callback to add non-null pipe items (not null)
>   **/
>  static void red_channel_pipes_create_batch(RedChannel *channel,
>                                  new_pipe_item_t creator, void *data,
> @@ -2262,7 +2262,9 @@ static void red_channel_pipes_create_batch(RedChannel
> *channel,
>      RING_FOREACH_SAFE(link, next, &channel->clients) {
>          rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
>          item = (*creator)(rcc, data, num++);
> -        (*pipe_add)(rcc, item);
> +        if (item) {
> +            (*pipe_add)(rcc, item);
> +        }
>      }
>  }
>  

Acked-by: Frediano Ziglio <fziglio at redhat>

However looks at comments in the dependent patch.
I didn't understand comment syntax and tool.

Frediano


More information about the Spice-devel mailing list