[tracker] libtracker-miner: don't create inner loop until needed
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: don't create inner loop until needed
- Date: Mon, 27 Sep 2010 16:21:21 +0000 (UTC)
commit 9cd4cd6ca97e81eed2a1e34ae2f055874895bb3f
Author: Aleksander Morgado <aleksander lanedo com>
Date: Mon Sep 27 15:20:16 2010 +0200
libtracker-miner: don't create inner loop until needed
src/libtracker-miner/tracker-miner-fs.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 1d65618..2eb5536 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2590,7 +2590,6 @@ ensure_mtime_cache (TrackerMinerFS *fs,
GFile *file)
{
gchar *query, *uri;
- CacheQueryData data;
GFile *parent;
guint cache_size;
@@ -2622,10 +2621,6 @@ ensure_mtime_cache (TrackerMinerFS *fs,
g_hash_table_remove_all (fs->private->mtime_cache);
- /* Initialize data contents */
- data.main_loop = g_main_loop_new (NULL, FALSE);
- data.values = g_hash_table_ref (fs->private->mtime_cache);
-
if (!parent || file_is_crawl_directory (fs, file)) {
/* File is a crawl directory itself, query its mtime directly */
uri = g_file_get_uri (file);
@@ -2655,6 +2650,12 @@ ensure_mtime_cache (TrackerMinerFS *fs,
}
if (query) {
+ CacheQueryData data;
+
+ /* Initialize data contents */
+ data.main_loop = g_main_loop_new (NULL, FALSE);
+ data.values = g_hash_table_ref (fs->private->mtime_cache);
+
tracker_sparql_connection_query_async (tracker_miner_get_connection (TRACKER_MINER (fs)),
query,
NULL,
@@ -2662,11 +2663,10 @@ ensure_mtime_cache (TrackerMinerFS *fs,
&data);
g_free (query);
g_main_loop_run (data.main_loop);
+ g_main_loop_unref (data.main_loop);
+ g_hash_table_unref (data.values);
}
- g_main_loop_unref (data.main_loop);
- g_hash_table_unref (data.values);
-
cache_size = g_hash_table_size (fs->private->mtime_cache);
/* Quite ugly hack: If mtime_cache is found EMPTY after the query, still, we
@@ -2677,6 +2677,8 @@ ensure_mtime_cache (TrackerMinerFS *fs,
if (parent &&
cache_size == 0 &&
miner_fs_has_children_without_parent (fs, parent)) {
+ CacheQueryData data;
+
/* Initialize data contents */
data.main_loop = g_main_loop_new (NULL, FALSE);
data.values = g_hash_table_ref (fs->private->mtime_cache);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]