]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
registry: refactor common part of registry initialization out.
authorMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 13:21:31 +0000 (15:21 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 8 May 2008 15:44:05 +0000 (17:44 +0200)
into a new function registry_init_common().

Michael
(cherry picked from commit 5da52b95ac69e4abfbc44335df2447bec8f16e13)

source/registry/reg_init_basic.c
source/registry/reg_init_full.c
source/registry/reg_init_smbconf.c

index cdf172c2899b5e50ca5d7553790bf829fba8214d..c5e2c346b0c649dc6c19de8413c8fb0ef5e3882a 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
-WERROR registry_init_basic(void)
+WERROR registry_init_common(void)
 {
        WERROR werr;
 
-       DEBUG(10, ("registry_init_basic called\n"));
-
        werr = regdb_init();
        if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(1, ("Failed to initialize the registry: %s\n",
+               DEBUG(0, ("Failed to initialize the registry: %s\n",
                          dos_errstr(werr)));
                goto done;
        }
 
        werr = reghook_cache_init();
        if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(1, ("Failed to initialize the reghook cache: %s\n",
+               DEBUG(0, ("Failed to initialize the reghook cache: %s\n",
                          dos_errstr(werr)));
        }
 
 done:
+       return werr;
+}
+
+WERROR registry_init_basic(void)
+{
+       WERROR werr;
+
+       DEBUG(10, ("registry_init_basic called\n"));
+
+       werr = registry_init_common();
        regdb_close();
        return werr;
 }
index da63453cd703bb3c7a77b9f0829b2907da62b20d..91e55d76b24f3d77594893e724ea283896caf466 100644 (file)
@@ -67,10 +67,8 @@ WERROR registry_init_full(void)
        int i;
        WERROR werr;
 
-       werr = regdb_init();
+       werr = registry_init_common();
        if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(0, ("Failed to initialize the registry: %s\n",
-                         dos_errstr(werr)));
                goto fail;
        }
 
@@ -84,13 +82,6 @@ WERROR registry_init_full(void)
 
        /* build the cache tree of registry hooks */
 
-       werr = reghook_cache_init();
-       if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(0, ("Failed to initialize the reghook cache: %s\n",
-                         dos_errstr(werr)));
-               goto fail;
-       }
-
        for ( i=0; reg_hooks[i].keyname; i++ ) {
                werr = reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops);
                if (!W_ERROR_IS_OK(werr)) {
index 2484200f90a0a8f2772f5627774724185aaeeaa4..43a5be025d04fc45937a5666f000fc5c09bc2170 100644 (file)
@@ -79,10 +79,8 @@ WERROR registry_init_smbconf(const char *keyname)
                keyname = KEY_SMBCONF;
        }
 
-       werr = regdb_init();
+       werr = registry_init_common();
        if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(1, ("Failed to initialize the registry: %s\n",
-                         dos_errstr(werr)));
                goto done;
        }
 
@@ -93,13 +91,6 @@ WERROR registry_init_smbconf(const char *keyname)
                goto done;
        }
 
-       werr = reghook_cache_init();
-       if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(1, ("Failed to initialize the reghook cache: %s\n",
-                         dos_errstr(werr)));
-               goto done;
-       }
-
        werr = reghook_cache_add(keyname, &smbconf_reg_ops);
        if (!W_ERROR_IS_OK(werr)) {
                DEBUG(1, ("Failed to add smbconf reghooks to reghook cache: "