tracker r3164 - in trunk: . src/trackerd



Author: mr
Date: Thu Apr  2 12:51:18 2009
New Revision: 3164
URL: http://svn.gnome.org/viewvc/tracker?rev=3164&view=rev

Log:
	* src/trackerd/tracker-monitor.c: (get_queue_from_gfile): Improve
	performance here, don't create/free a new list and iterate the
	hash table twice. This operation should be faster. Patch from
	Philip Van Hoof.


Modified:
   trunk/ChangeLog
   trunk/src/trackerd/tracker-monitor.c

Modified: trunk/src/trackerd/tracker-monitor.c
==============================================================================
--- trunk/src/trackerd/tracker-monitor.c	(original)
+++ trunk/src/trackerd/tracker-monitor.c	Thu Apr  2 12:51:18 2009
@@ -492,23 +492,22 @@
 get_queue_from_gfile (GHashTable *modules,
 		      GFile	 *file)
 {
-	GHashTable  *hash_table;
-	GList	    *all_modules, *l;
-	const gchar *module_name = NULL;
+	GHashTableIter iter;
+	gpointer       key, value;
 
-	all_modules = g_hash_table_get_keys (modules);
+	g_hash_table_iter_init (&iter, modules);
 
-	for (l = all_modules; l && !module_name; l = l->next) {
-		hash_table = g_hash_table_lookup (modules, l->data);
+	while (g_hash_table_iter_next (&iter, &key, &value)) {
+		GHashTable *hash_table;
+
+		hash_table = value;
 
 		if (g_hash_table_lookup (hash_table, file)) {
-			module_name = l->data;
+			return key;
 		}
 	}
 
-	g_list_free (all_modules);
-
-	return module_name;
+	return NULL;
 }
 
 static const gchar *



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