From 05cb01fc321051e168ee8dc8a798bebea770bbcd Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 29 Jun 2011 11:52:49 +0300 Subject: [PATCH] Make use of g_slist_free_full on attrib --- attrib/client.c | 6 ++---- attrib/gatt.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/attrib/client.c b/attrib/client.c index 71df532c0..c9629c403 100644 --- a/attrib/client.c +++ b/attrib/client.c @@ -140,8 +140,7 @@ static void primary_free(void *user_data) g_dbus_remove_watch(prim->gatt->conn, watcher->id); } - g_slist_foreach(prim->chars, (GFunc) characteristic_free, NULL); - g_slist_free(prim->chars); + g_slist_free_full(prim->chars, characteristic_free); g_free(prim->path); g_free(prim); } @@ -150,8 +149,7 @@ static void gatt_service_free(void *user_data) { struct gatt_service *gatt = user_data; - g_slist_foreach(gatt->primary, (GFunc) primary_free, NULL); - g_slist_free(gatt->primary); + g_slist_free_full(gatt->primary, primary_free); g_attrib_unref(gatt->attrib); g_free(gatt->path); btd_device_unref(gatt->dev); diff --git a/attrib/gatt.c b/attrib/gatt.c index 1ed78ecc6..a27d1af93 100644 --- a/attrib/gatt.c +++ b/attrib/gatt.c @@ -59,8 +59,7 @@ static void discover_primary_free(struct discover_primary *dp) static void discover_char_free(struct discover_char *dc) { - g_slist_foreach(dc->characteristics, (GFunc) g_free, NULL); - g_slist_free(dc->characteristics); + g_slist_free_full(dc->characteristics, g_free); g_attrib_unref(dc->attrib); g_free(dc->uuid); g_free(dc); -- 2.47.3