aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-03-11 20:22:19 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-03-11 20:22:19 +0800
commit1f33373505c9f42a9c9d764431a0b53bf993d31b (patch)
tree611537d013f5339558306f565fa61a76a301320c /libempathy
parentf968742063aedff5b0e3814d4db3b1259d6cd1e8 (diff)
downloadgsoc2013-empathy-1f33373505c9f42a9c9d764431a0b53bf993d31b.tar
gsoc2013-empathy-1f33373505c9f42a9c9d764431a0b53bf993d31b.tar.gz
gsoc2013-empathy-1f33373505c9f42a9c9d764431a0b53bf993d31b.tar.bz2
gsoc2013-empathy-1f33373505c9f42a9c9d764431a0b53bf993d31b.tar.lz
gsoc2013-empathy-1f33373505c9f42a9c9d764431a0b53bf993d31b.tar.xz
gsoc2013-empathy-1f33373505c9f42a9c9d764431a0b53bf993d31b.tar.zst
gsoc2013-empathy-1f33373505c9f42a9c9d764431a0b53bf993d31b.zip
Lazy init of contact hash.
svn path=/trunk/; revision=746
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 13b526041..d841a1b76 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -52,6 +52,7 @@ struct _EmpathyContactPriv {
guint handle;
EmpathyCapabilities capabilities;
gboolean is_user;
+ guint hash;
};
static void empathy_contact_class_init (EmpathyContactClass *class);
@@ -689,15 +690,15 @@ guint
empathy_contact_hash (gconstpointer key)
{
EmpathyContactPriv *priv;
- guint hash;
g_return_val_if_fail (EMPATHY_IS_CONTACT (key), +1);
priv = GET_PRIV (EMPATHY_CONTACT (key));
- hash = empathy_account_hash (empathy_contact_get_account (EMPATHY_CONTACT (key)));
- hash += g_str_hash (empathy_contact_get_id (EMPATHY_CONTACT (key)));
+ if (priv->hash == 0) {
+ priv->hash = empathy_account_hash (priv->account) + g_str_hash (priv->id);
+ }
- return hash;
+ return priv->hash;
}