[evolution-patches] Exchange, fixes a few redundant computation.



Hi,

This patch fixes some redundant computation
in exchange-account.c.

Ok to commit?

Thanks,
Arunprakash.

Index: servers/exchange/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.26
diff -u -p -r1.26 ChangeLog
--- servers/exchange/ChangeLog	22 Aug 2005 13:08:57 -0000	1.26
+++ servers/exchange/ChangeLog	23 Aug 2005 11:28:20 -0000
@@ -1,3 +1,8 @@
+2005-08-23  Arunprakash  <arunp novell com>
+
+	* storage/exchange-account.c (hierarchy_new_folder) : Removes
+	redundant computation.
+	
 2005-08-22  Sarfraaz Ahmed <asarfraaz novell com>
 
 	* storage/exchange-account.c (get_password) : Store the password
Index: servers/exchange/storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v
retrieving revision 1.13
diff -u -p -r1.13 exchange-account.c
--- servers/exchange/storage/exchange-account.c	22 Aug 2005 13:08:58 -0000	1.13
+++ servers/exchange/storage/exchange-account.c	23 Aug 2005 11:28:22 -0000
@@ -357,17 +357,18 @@ hierarchy_new_folder (ExchangeHierarchy 
 	int table_updated = 0;
 	const char *permanent_uri =
 		e_folder_exchange_get_permanent_uri (folder);
+	char *key;
 
 	/* This makes the cleanup easier. We just unref it each time
 	 * we find it in account->priv->folders.
 	 */
-	if (!g_hash_table_lookup (account->priv->folders, 
-				e_folder_exchange_get_path (folder))) {
+	key = (char *) e_folder_exchange_get_path (folder);
+	if (!g_hash_table_lookup (account->priv->folders, key)) {
 		/* Avoid dupilcations since the user could add a folder as
 		  favorite even though it is already marked as favorite */
 		g_object_ref (folder);
 		g_hash_table_insert (account->priv->folders,
-				     (char *)e_folder_exchange_get_path (folder),
+				     key,
 				     folder);
 		table_updated = 1;
 	}
@@ -375,31 +376,33 @@ hierarchy_new_folder (ExchangeHierarchy 
 	if (account->priv->fresh_folders) {
 		g_object_ref (folder);
 		g_hash_table_insert (account->priv->fresh_folders,
-				     (char *)e_folder_exchange_get_path (folder),
+				     key,
 				     folder);
 	}	
 	
-	if (!g_hash_table_lookup (account->priv->folders, 
-				e_folder_get_physical_uri (folder))) {
+	key = (char *) e_folder_get_physical_uri (folder);
+	if (!g_hash_table_lookup (account->priv->folders, key)) {
 		/* Avoid dupilcations since the user could add a folder as
 		  favorite even though it is already marked as favorite */
 		g_object_ref (folder);
 		g_hash_table_insert (account->priv->folders,
-				     (char *)e_folder_get_physical_uri (folder),
+				     key,
 				     folder);
 		table_updated = 1;
 	}
-	if (!g_hash_table_lookup (account->priv->folders, 
-				e_folder_exchange_get_internal_uri (folder))) {
+
+	key = (char *) e_folder_exchange_get_internal_uri (folder);
+	if (!g_hash_table_lookup (account->priv->folders, key)) {
 		/* The internal_uri for public folders and favorites folder 
 		   is same !!! Without this check the folder value could 
 		   overwrite the previously added folder. */
 		g_object_ref (folder);
 		g_hash_table_insert (account->priv->folders,
-				     (char *)e_folder_exchange_get_internal_uri (folder),
+				     key,
 				     folder);
 		table_updated = 1;
 	}
+
 	if (permanent_uri && (!g_hash_table_lookup (account->priv->folders, 
 					permanent_uri))) {
 		g_object_ref (folder);
@@ -408,7 +411,7 @@ hierarchy_new_folder (ExchangeHierarchy 
 				     folder);
 		table_updated = 1;
 	}
-
+	
 	if (table_updated)
 	{
 		g_hash_table_insert (account->priv->hierarchies_by_folder, 


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