From 0d048414480f7416f38f930c14187c6aea5f4919 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 21 Dec 2012 16:56:00 +0200 Subject: [PATCH] core: Add btd_profile_remove_custom_prop function btd_profile_remove_custom_prop should be used when the user_data passed to btd_profile_add_custom_prop is invalidated/destroyed. --- src/profile.c | 18 ++++++++++++++++++ src/profile.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/profile.c b/src/profile.c index 7bb1db56f..c7c791c20 100644 --- a/src/profile.c +++ b/src/profile.c @@ -2235,6 +2235,24 @@ static void free_property(gpointer data) g_free(p); } +void btd_profile_remove_custom_prop(const char *uuid, const char *name) +{ + GSList *l; + + for (l = custom_props; l; l = l->next) { + struct btd_profile_custom_property *prop = l->data; + + if (strcasecmp(prop->uuid, uuid) != 0) + continue; + + if (g_strcmp0(prop->name, name) != 0) + continue; + + custom_props = g_slist_delete_link(custom_props, l); + free_property(prop); + } +} + void btd_profile_init(void) { g_dbus_register_interface(btd_get_dbus_connection(), diff --git a/src/profile.h b/src/profile.h index 8339c7a63..fe332d99a 100644 --- a/src/profile.h +++ b/src/profile.h @@ -72,6 +72,7 @@ void btd_profile_add_custom_prop(const char *uuid, const char *type, btd_profile_prop_exists exists, btd_profile_prop_get get, void *user_data); +void btd_profile_remove_custom_prop(const char *uuid, const char *name); void btd_profile_init(void); void btd_profile_cleanup(void); -- 2.47.3