summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2014-05-24 18:47:40 +0200
committerJens Georg <mail@jensge.org>2014-05-24 18:47:40 +0200
commit8abfa8082997bf59cd20aba2bd86de0eb3f88279 (patch)
tree22e7dfda0b77057b6957c711615483dc5ae8d46f
parent9ffedf49b5793429c27ca0e8aa124b6438dbfc33 (diff)
downloadgupnp-8abfa8082997bf59cd20aba2bd86de0eb3f88279.tar.gz
Use g_list_free_full
Signed-off-by: Jens Georg <mail@jensge.org>
-rw-r--r--libgupnp/gupnp-context.c18
-rw-r--r--libgupnp/gupnp-device-info.c5
-rw-r--r--libgupnp/gupnp-service-proxy.c17
-rw-r--r--libgupnp/gupnp-service.c13
4 files changed, 10 insertions, 43 deletions
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index 28baa66..e2865e6 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -1129,10 +1129,7 @@ host_path_handler (G_GNUC_UNUSED SoupServer *server,
g_free (path_to_open);
g_free (local_path);
- while (orig_locales) {
- g_free (orig_locales->data);
- orig_locales = g_list_delete_link (orig_locales, orig_locales);
- }
+ g_list_free_full (orig_locales, g_free);
}
static UserAgent *
@@ -1181,17 +1178,8 @@ host_path_data_free (HostPathData *path_data)
g_free (path_data->server_path);
g_free (path_data->default_language);
- while (path_data->user_agents) {
- UserAgent *agent;
-
- agent = path_data->user_agents->data;
-
- user_agent_free (agent);
-
- path_data->user_agents = g_list_delete_link (
- path_data->user_agents,
- path_data->user_agents);
- }
+ g_list_free_full (path_data->user_agents,
+ (GDestroyNotify) user_agent_free);
g_slice_free (HostPathData, path_data);
}
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c
index 1bb6efe..0e21ee4 100644
--- a/libgupnp/gupnp-device-info.c
+++ b/libgupnp/gupnp-device-info.c
@@ -864,10 +864,7 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info,
}
/* Cleanup */
- while (icons) {
- icon_free (icons->data);
- icons = g_list_delete_link (icons, icons);
- }
+ g_list_free_full (icons, (GDestroyNotify) icon_free);
return ret;
}
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index c0bbcfe..ec1253b 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -294,12 +294,8 @@ gupnp_service_proxy_dispose (GObject *object)
proxy->priv->notify_idle_src = NULL;
}
- while (proxy->priv->pending_notifies) {
- emit_notify_data_free (proxy->priv->pending_notifies->data);
- proxy->priv->pending_notifies =
- g_list_delete_link (proxy->priv->pending_notifies,
- proxy->priv->pending_notifies);
- }
+ g_list_free_full (proxy->priv->pending_notifies,
+ (GDestroyNotify) emit_notify_data_free);
/* Call super */
object_class = G_OBJECT_CLASS (gupnp_service_proxy_parent_class);
@@ -1872,13 +1868,8 @@ emit_notifications (gpointer user_data)
}
/* Cleanup */
- while (proxy->priv->pending_notifies != NULL) {
- emit_notify_data_free (proxy->priv->pending_notifies->data);
-
- proxy->priv->pending_notifies =
- g_list_delete_link (proxy->priv->pending_notifies,
- proxy->priv->pending_notifies);
- }
+ g_list_free_full (proxy->priv->pending_notifies,
+ (GDestroyNotify) emit_notify_data_free);
proxy->priv->notify_idle_src = NULL;
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 486cde4..8e203f6 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -168,11 +168,7 @@ subscription_data_free (SubscriptionData *data)
}
/* Further cleanup */
- while (data->callbacks) {
- g_free (data->callbacks->data);
- data->callbacks = g_list_delete_link (data->callbacks,
- data->callbacks);
- }
+ g_list_free_full (data->callbacks, g_free);
g_free (data->sid);
@@ -1624,12 +1620,7 @@ gupnp_service_finalize (GObject *object)
g_hash_table_destroy (service->priv->subscriptions);
/* Free state variable list */
- while (service->priv->state_variables) {
- g_free (service->priv->state_variables->data);
- service->priv->state_variables =
- g_list_delete_link (service->priv->state_variables,
- service->priv->state_variables);
- }
+ g_list_free_full (service->priv->state_variables, g_free);
/* Free notify queue */
while ((data = g_queue_pop_head (service->priv->notify_queue)))