]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Avoid g_queue_foreach
authorSimon McVittie <smcv@collabora.com>
Mon, 23 Jul 2018 17:02:42 +0000 (18:02 +0100)
committerSimon McVittie <smcv@collabora.com>
Thu, 2 Aug 2018 14:26:47 +0000 (15:26 +0100)
In gcc 8, -Wall -Wextra includes -Wcast-function-type, which warns
about passing an extra (unwanted) parameter to callbacks. Instead
of using g_list_foreach(), open-code the equivalent.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107349
Reviewed-by: Thiago Macieira <thiago@kde.org>
test/dbus-daemon.c
test/header-fields.c
test/monitor.c

index 222b1028c3c4768916a340379e2c09f9a1c2a60b..d25267ae04084723acb22ab2e99ac350217aa089 100644 (file)
@@ -1930,6 +1930,8 @@ teardown (Fixture *f,
 
   if (f->right_conn != NULL)
     {
+      GList *link;
+
       if (f->right_conn_echo)
         {
           dbus_connection_remove_filter (f->right_conn, echo_filter, f);
@@ -1942,7 +1944,9 @@ teardown (Fixture *f,
           f->right_conn_hold = FALSE;
         }
 
-      g_queue_foreach (&f->held_messages, (GFunc) dbus_message_unref, NULL);
+      for (link = f->held_messages.head; link != NULL; link = link->next)
+        dbus_message_unref (link->data);
+
       g_queue_clear (&f->held_messages);
 
       dbus_connection_close (f->right_conn);
index 088953bfc9cce87031caf7d3f58f9b8ae2126ad0..019ff21818257b76d1a7a5ee48f46f20a7047ba3 100644 (file)
@@ -719,10 +719,14 @@ out:
 
   if (f->right_conn != NULL)
     {
+      GList *link;
+
       if (added_hold_filter)
         dbus_connection_remove_filter (f->right_conn, hold_filter, f);
 
-      g_queue_foreach (&f->held_messages, (GFunc) dbus_message_unref, NULL);
+      for (link = f->held_messages.head; link != NULL; link = link->next)
+        dbus_message_unref (link->data);
+
       g_queue_clear (&f->held_messages);
 
       dbus_connection_close (f->right_conn);
index 57f13af8508f22085958546cebd2dea257ff915b..95b394bf3ec263380a80954daa132e02867ac4aa 100644 (file)
@@ -1882,6 +1882,8 @@ static void
 teardown (Fixture *f,
     gconstpointer context G_GNUC_UNUSED)
 {
+  GList *link;
+
   dbus_error_free (&f->e);
   g_clear_error (&f->ge);
 
@@ -1936,10 +1938,14 @@ teardown (Fixture *f,
 
   test_main_context_unref (f->ctx);
 
-  g_queue_foreach (&f->monitored, (GFunc) dbus_message_unref, NULL);
+  for (link = f->monitored.head; link != NULL; link = link->next)
+    dbus_message_unref (link->data);
+
   g_queue_clear (&f->monitored);
 
-  g_queue_foreach (&f->received, (GFunc) dbus_message_unref, NULL);
+  for (link = f->received.head; link != NULL; link = link->next)
+    dbus_message_unref (link->data);
+
   g_queue_clear (&f->received);
 
   g_free (f->address);