aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-05-04 02:07:17 +0800
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-05-08 01:37:02 +0800
commita91210ddb56d7b4825c3920d18a1e34cfef11f8c (patch)
treebfe0be50aaf2698d6d4017d9bf4a9c76fa22a5fc
parentf6523fe873a1f7a110f3aeb87a727486864e70cc (diff)
downloadgsoc2013-empathy-a91210ddb56d7b4825c3920d18a1e34cfef11f8c.tar
gsoc2013-empathy-a91210ddb56d7b4825c3920d18a1e34cfef11f8c.tar.gz
gsoc2013-empathy-a91210ddb56d7b4825c3920d18a1e34cfef11f8c.tar.bz2
gsoc2013-empathy-a91210ddb56d7b4825c3920d18a1e34cfef11f8c.tar.lz
gsoc2013-empathy-a91210ddb56d7b4825c3920d18a1e34cfef11f8c.tar.xz
gsoc2013-empathy-a91210ddb56d7b4825c3920d18a1e34cfef11f8c.tar.zst
gsoc2013-empathy-a91210ddb56d7b4825c3920d18a1e34cfef11f8c.zip
Use iters on hash tables instead of foreach
-rw-r--r--libempathy/empathy-tp-contact-factory.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index b85147cdb..5965f0e64 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -462,15 +462,6 @@ tp_contact_factory_capabilities_changed_cb (TpConnection *connection,
}
static void
-update_location_for_each (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GHashTable *location = (GHashTable*) user_data;
- g_hash_table_insert (location, g_strdup (key), tp_g_value_slice_dup (value));
-}
-
-static void
tp_contact_factory_location_updated_cb (TpProxy *proxy,
guint handle,
GHashTable *location,
@@ -480,6 +471,9 @@ tp_contact_factory_location_updated_cb (TpProxy *proxy,
EmpathyTpContactFactory *tp_factory = EMPATHY_TP_CONTACT_FACTORY (weak_object);
EmpathyContact *contact;
GHashTable *new_location;
+ GHashTableIter iter;
+ gpointer key;
+ gpointer value;
contact = tp_contact_factory_find_by_handle (tp_factory, handle);
@@ -490,7 +484,12 @@ tp_contact_factory_location_updated_cb (TpProxy *proxy,
(GDestroyNotify) tp_g_value_slice_free);
// Copy keys
- g_hash_table_foreach (location, update_location_for_each, new_location);
+ g_hash_table_iter_init (&iter, location);
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ g_hash_table_insert (location,
+ g_strdup (key),
+ tp_g_value_slice_dup (value));
+ }
empathy_contact_set_location (contact, new_location);
}