[Spice-devel] [PATCH server v2 06/13] channel: document pipes_create_batch() function

Frediano Ziglio fziglio at redhat.com
Fri Jan 22 04:54:55 PST 2016


> 
> Rename callback to pipe_add, and document the arguments.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> ---
>  server/red-channel.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/server/red-channel.c b/server/red-channel.c
> index b33c91d..7296820 100644
> --- a/server/red-channel.c
> +++ b/server/red-channel.c
> @@ -2240,21 +2240,29 @@ int red_client_during_migrate_at_target(RedClient
> *client)
>  typedef void (*rcc_item_t)(RedChannelClient *rcc, PipeItem *item);
>  typedef int (*rcc_item_cond_t)(RedChannelClient *rcc, PipeItem *item);
>  
> +/**
> + * red_channel_pipes_create_batch:
> + * @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)
> + **/
>  static void red_channel_pipes_create_batch(RedChannel *channel,
>                                  new_pipe_item_t creator, void *data,
> -                                rcc_item_t callback)
> +                                rcc_item_t pipe_add)
>  {
>      RingItem *link, *next;
>      RedChannelClient *rcc;
>      PipeItem *item;
>      int num = 0;
>  
> +    spice_assert(creator != NULL);
> +    spice_assert(pipe_add != NULL);
> +
>      RING_FOREACH_SAFE(link, next, &channel->clients) {
>          rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
>          item = (*creator)(rcc, data, num++);
> -        if (callback) {
> -            (*callback)(rcc, item);
> -        }
> +        (*pipe_add)(rcc, item);
>      }
>  }
>  

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano


More information about the Spice-devel mailing list