empathy r746 - trunk/libempathy



Author: xclaesse
Date: Tue Mar 11 12:22:19 2008
New Revision: 746
URL: http://svn.gnome.org/viewvc/empathy?rev=746&view=rev

Log:
Lazy init of contact hash.


Modified:
   trunk/libempathy/empathy-contact.c

Modified: trunk/libempathy/empathy-contact.c
==============================================================================
--- trunk/libempathy/empathy-contact.c	(original)
+++ trunk/libempathy/empathy-contact.c	Tue Mar 11 12:22:19 2008
@@ -52,6 +52,7 @@
 	guint               handle;
 	EmpathyCapabilities capabilities;
 	gboolean            is_user;
+	guint               hash;
 };
 
 static void empathy_contact_class_init (EmpathyContactClass *class);
@@ -689,15 +690,15 @@
 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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]