diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-04-08 15:17:19 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-04-08 15:17:19 +0100 |
commit | 8b060cd9144990aae6531982bad66050fafcb658 (patch) | |
tree | f555c2a0d1bbd215fc350831711db428db5250a1 /json-glib/json-object.c | |
parent | 2158cecee6fe1da8786afe2fad94d1098f879786 (diff) | |
download | json-glib-8b060cd9144990aae6531982bad66050fafcb658.tar.gz |
object: Use g_list_find_custom()
Instead of manual iteration, let's use the function GList provides us.
Diffstat (limited to 'json-glib/json-object.c')
-rw-r--r-- | json-glib/json-object.c | 13 |
1 files changed, 3 insertions, 10 deletions
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); |