From 8b060cd9144990aae6531982bad66050fafcb658 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 8 Apr 2011 15:17:19 +0100 Subject: object: Use g_list_find_custom() Instead of manual iteration, let's use the function GList provides us. --- json-glib/json-object.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'json-glib/json-object.c') diff --git a/json-glib/json-object.c b/json-glib/json-object.c index 1a655de..438366b 100644 --- a/json-glib/json-object.c +++ b/json-glib/json-object.c @@ -141,16 +141,9 @@ object_set_member_internal (JsonObject *object, * pointer to its name, to avoid keeping invalid pointers * once we replace the key in the hash table */ - for (l = object->members_ordered; l != NULL; l = l->next) - { - gchar *tmp = l->data; - - if (strcmp (tmp, name) == 0) - { - l->data = name; - break; - } - } + l = g_list_find_custom (object->members_ordered, name, (GCompareFunc) strcmp); + if (l != NULL) + l->data = name; } g_hash_table_replace (object->members, name, node); -- cgit v1.2.1