[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 17/116] libtracker-miner: Simplify code a bit



commit ba2eb47cc43cd3ddc034f7c2e88dfcc14db021cd
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 9 23:14:30 2017 +0200

    libtracker-miner: Simplify code a bit
    
    We can steal data sooner in order to avoid unsetting the data in the early
    return path.

 src/libtracker-miner/tracker-file-notifier.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index e5231bfc3..4ab0e69a3 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -282,24 +282,22 @@ file_notifier_traverse_tree_foreach (GFile    *file,
        priv = notifier->priv;
        current_root = priv->current_index_root->current_dir;
 
+       store_mtime = tracker_file_system_steal_property (priv->file_system, file,
+                                                         quark_property_store_mtime);
+       disk_mtime = tracker_file_system_steal_property (priv->file_system, file,
+                                                        quark_property_filesystem_mtime);
+
        /* If we're crawling over a subdirectory of a root index, it's been
         * already notified in the crawling op that made it processed, so avoid
         * it here again.
         */
        if (current_root == file &&
            current_root != priv->current_index_root->root) {
-               tracker_file_system_unset_property (priv->file_system, file,
-                                                   quark_property_filesystem_mtime);
-               tracker_file_system_unset_property (priv->file_system, file,
-                                                   quark_property_store_mtime);
+               g_free (store_mtime);
+               g_free (disk_mtime);
                return FALSE;
        }
 
-       store_mtime = tracker_file_system_steal_property (priv->file_system, file,
-                                                         quark_property_store_mtime);
-       disk_mtime = tracker_file_system_steal_property (priv->file_system, file,
-                                                        quark_property_filesystem_mtime);
-
        if (store_mtime && !disk_mtime) {
                /* In store but not in disk, delete */
                g_signal_emit (notifier, signals[FILE_DELETED], 0, file);


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