registry cachehook: revert logic to make fast path more obvious and reduce indent.
authorMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 12:40:51 +0000 (14:40 +0200)
committerMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 13:33:47 +0000 (15:33 +0200)
Michael

source/registry/reg_cachehook.c

index c7f099e134c25d84bbe43174b2283556d534b284..db07330820dbac2976706e18f22f8a6fd7fddc24 100644 (file)
@@ -56,16 +56,17 @@ static char *keyname_to_path(TALLOC_CTX *mem_ctx, const char *keyname)
 
 WERROR reghook_cache_init(void)
 {
-       if (cache_tree == NULL) {
-               cache_tree = pathtree_init(&regdb_ops, NULL);
-               if (cache_tree == NULL) {
-                       return WERR_NOMEM;
-               }
-               DEBUG(10, ("reghook_cache_init: new tree with default "
-                          "ops %p for key [%s]\n", (void *)&regdb_ops,
-                          KEY_TREE_ROOT));
+       if (cache_tree != NULL) {
+               return WERR_OK;
        }
 
+       cache_tree = pathtree_init(&regdb_ops, NULL);
+       if (cache_tree == NULL) {
+               return WERR_NOMEM;
+       }
+       DEBUG(10, ("reghook_cache_init: new tree with default "
+                  "ops %p for key [%s]\n", (void *)&regdb_ops,
+                  KEY_TREE_ROOT));
        return WERR_OK;
 }