From e5fa7f4740d817b905379e6ffccb135cf1aa98e5 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lureau Date: Thu, 14 Jan 2016 22:01:06 +0100 Subject: [PATCH] channel: document pipes_create_batch() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename callback to pipe_add, and document the arguments. Signed-off-by: Marc-André Lureau Acked-by: Frediano Ziglio --- 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 2cf190c4..9ea7ca50 100644 --- a/server/red-channel.c +++ b/server/red-channel.c @@ -2228,21 +2228,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); } }