[gupnp] [PATCH] Simplify code in notify_available_cb()



Instead of calling g_hash_table_foreach_remove() with a callback
function that always returns TRUE, just call g_hash_table_remove_all().
---
 libgupnp/gupnp-service.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 68d3940..64a5ca8 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -1387,14 +1387,6 @@ gupnp_service_constructor (GType                  type,
         return object;
 }
 
-static gboolean
-say_yes (gpointer key,
-         gpointer value,
-         gpointer user_data)
-{
-        return TRUE;
-}
-
 /* Root device availability changed. */
 static void
 notify_available_cb (GObject *object,
@@ -1407,9 +1399,7 @@ notify_available_cb (GObject *object,
 
         if (!gupnp_root_device_get_available (GUPNP_ROOT_DEVICE (object))) {
                 /* Root device now unavailable: Purge subscriptions */
-                g_hash_table_foreach_remove (service->priv->subscriptions,
-                                             say_yes,
-                                             NULL);
+                g_hash_table_remove_all (service->priv->subscriptions);
         }
 }
 
-- 
1.7.0.4

--
To unsubscribe send a mail to gupnp+unsubscribe\@o-hand.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]