[Spice-commits] 2 commits - server/red-channel.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Fri Jan 22 05:23:29 PST 2016
server/red-channel.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
New commits:
commit 3d9ea0bb6ba5e94949444e8f848008b4dbe80a49
Author: Marc-Andre Lureau <marcandre.lureau at gmail.com>
Date: Thu Jan 14 22:01:07 2016 +0100
channel: do not call pipe_add with null items
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>
Acked-by: Frediano Ziglio <fziglio at redhat>
diff --git a/server/red-channel.c b/server/red-channel.c
index 9ea7ca5..fd41493 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -2233,7 +2233,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,
@@ -2250,7 +2250,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);
+ }
}
}
commit e5fa7f4740d817b905379e6ffccb135cf1aa98e5
Author: Marc-Andre Lureau <marcandre.lureau at gmail.com>
Date: Thu Jan 14 22:01:06 2016 +0100
channel: document pipes_create_batch() function
Rename callback to pipe_add, and document the arguments.
Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
Acked-by: Frediano Ziglio <fziglio at redhat>
diff --git a/server/red-channel.c b/server/red-channel.c
index 2cf190c..9ea7ca5 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);
}
}
More information about the Spice-commits
mailing list