From 4ae2e8c7ba7f4bf12e83c68eacd9cb4c1b914be5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 15:21:31 +0200 Subject: [PATCH] registry: refactor common part of registry initialization out. into a new function registry_init_common(). Michael (This used to be commit 5da52b95ac69e4abfbc44335df2447bec8f16e13) --- source3/registry/reg_init_basic.c | 18 +++++++++++++----- source3/registry/reg_init_full.c | 11 +---------- source3/registry/reg_init_smbconf.c | 11 +---------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index cdf172c2899..c5e2c346b0c 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -22,26 +22,34 @@ #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; } diff --git a/source3/registry/reg_init_full.c b/source3/registry/reg_init_full.c index e24cb61481b..ae12e307666 100644 --- a/source3/registry/reg_init_full.c +++ b/source3/registry/reg_init_full.c @@ -68,10 +68,8 @@ bool init_registry( void ) WERROR werr; bool ret = false; - 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; } @@ -85,13 +83,6 @@ bool init_registry( 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)) { diff --git a/source3/registry/reg_init_smbconf.c b/source3/registry/reg_init_smbconf.c index fafaf7952f6..a05da854cfb 100644 --- a/source3/registry/reg_init_smbconf.c +++ b/source3/registry/reg_init_smbconf.c @@ -80,10 +80,8 @@ bool 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; } @@ -94,13 +92,6 @@ bool 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: " -- 2.11.4.GIT