[Xfce4-commits] <xfconf:master> Don't look for existing keys during prefetch.

Nick Schermer noreply at xfce.org
Wed Feb 10 12:38:02 CET 2010


Updating branch refs/heads/master
         to 4705ae3b1628a0202862cf1d0a5b7119376f1db2 (commit)
       from 167c0162acf12463b420c9e6451ec56725d602a5 (commit)

commit 4705ae3b1628a0202862cf1d0a5b7119376f1db2
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Feb 10 12:17:28 2010 +0100

    Don't look for existing keys during prefetch.
    
    Since each channel has its own cache, we can avoid updating
    values because the hash table contains unique properties and
    there are no nodes in the tree yet.

 xfconf/xfconf-cache.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/xfconf/xfconf-cache.c b/xfconf/xfconf-cache.c
index 95c09da..baefcfd 100644
--- a/xfconf/xfconf-cache.c
+++ b/xfconf/xfconf-cache.c
@@ -599,20 +599,13 @@ xfconf_cache_prefetch_ht(gpointer key,
                          gpointer value,
                          gpointer user_data)
 {
-    gchar *property = key;
-    GValue *val = value;
     XfconfCache *cache = XFCONF_CACHE(user_data);
     XfconfCacheItem *item;
 
-    item = g_tree_lookup(cache->properties, property);
-    if(item) {
-        xfconf_cache_item_update(item, val);
-        return FALSE;
-    } else {
-        item = xfconf_cache_item_new(val, TRUE);
-        g_tree_insert(cache->properties, property, item);
-        return TRUE;
-    }
+    item = xfconf_cache_item_new(value, TRUE);
+    g_tree_insert(cache->properties, key, item);
+
+    return TRUE;
 }
 
 gboolean
@@ -625,6 +618,8 @@ xfconf_cache_prefetch(XfconfCache *cache,
     DBusGProxy *proxy = _xfconf_get_dbus_g_proxy();
     GError *tmp_error = NULL;
 
+    g_return_val_if_fail(g_tree_nnodes(cache->properties) == 0, FALSE);
+
     xfconf_cache_mutex_lock(&cache->cache_lock);
 
     if(xfconf_client_get_all_properties(proxy, cache->channel_name,



More information about the Xfce4-commits mailing list