[Spice-devel] [PATCH spice-server v8 09/12] fixup! Convert RedChannel hierarchy to GObject

Frediano Ziglio fziglio at redhat.com
Mon Oct 24 08:40:52 UTC 2016


Reuse new macro to scan GLists (not available when this patch was
originally written).

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 186c2e1..de0d356 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -469,10 +469,10 @@ void reds_unregister_channel(RedsState *reds, RedChannel *channel)
 
 static RedChannel *reds_find_channel(RedsState *reds, uint32_t type, uint32_t id)
 {
-    GList *l;
+    GListIter it;
+    RedChannel *channel;
 
-    for (l = reds->channels; l != NULL; l = l->next) {
-        RedChannel *channel = l->data;
+    GLIST_FOREACH(reds->channels, it, RedChannel, channel) {
         uint32_t this_type, this_id;
         g_object_get(channel, "channel-type", &this_type, "id", &this_id, NULL);
         if (this_type == type && this_id == id) {
@@ -997,12 +997,12 @@ static int channel_supports_multiple_clients(RedChannel *channel)
 
 static void reds_fill_channels(RedsState *reds, SpiceMsgChannels *channels_info)
 {
-    GList *l;
+    GListIter it;
+    RedChannel *channel;
     int used_channels = 0;
 
-    for (l = reds->channels; l != NULL; l = l->next) {
+    GLIST_FOREACH(reds->channels, it, RedChannel, channel) {
         uint32_t type, id;
-        RedChannel *channel = l->data;
         if (reds->num_clients > 1 &&
             !channel_supports_multiple_clients(channel)) {
             continue;
-- 
2.7.4



More information about the Spice-devel mailing list