From: Michael Adam Date: Wed, 26 Mar 2008 22:11:04 +0000 (+0100) Subject: libsmbconf: in text backend, put flushing of the cache into a helper function. X-Git-Tag: samba-3.3.0pre1~3093 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8cb288124993eb59459e7e9777c65e58c0554d55;p=thirdparty%2Fsamba.git libsmbconf: in text backend, put flushing of the cache into a helper function. And use it also in the close operation. Michael --- diff --git a/source/lib/smbconf/smbconf_txt_simple.c b/source/lib/smbconf/smbconf_txt_simple.c index 4bd3eeeb2b7..f149a1623c2 100644 --- a/source/lib/smbconf/smbconf_txt_simple.c +++ b/source/lib/smbconf/smbconf_txt_simple.c @@ -168,6 +168,16 @@ static bool smbconf_txt_do_parameter(const char *param_name, return W_ERROR_IS_OK(werr); } +static void smbconf_txt_flush_cache(struct smbconf_ctx *ctx) +{ + TALLOC_FREE(pd(ctx)->cache.share_names); + pd(ctx)->cache.current_share = 0; + pd(ctx)->cache.num_shares = 0; + TALLOC_FREE(pd(ctx)->cache.param_names); + TALLOC_FREE(pd(ctx)->cache.param_values); + TALLOC_FREE(pd(ctx)->cache.num_params); +} + static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx) { uint64_t new_csn = (uint64_t)file_modtime(ctx->path); @@ -176,12 +186,7 @@ static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx) return WERR_OK; } - TALLOC_FREE(pd(ctx)->cache.share_names); - pd(ctx)->cache.current_share = 0; - pd(ctx)->cache.num_shares = 0; - TALLOC_FREE(pd(ctx)->cache.param_names); - TALLOC_FREE(pd(ctx)->cache.param_values); - TALLOC_FREE(pd(ctx)->cache.num_params); + smbconf_txt_flush_cache(ctx); if (!pm_process(ctx->path, smbconf_txt_do_section, smbconf_txt_do_parameter, pd(ctx))) @@ -231,6 +236,7 @@ static WERROR smbconf_txt_open(struct smbconf_ctx *ctx) static int smbconf_txt_close(struct smbconf_ctx *ctx) { + smbconf_txt_flush_cache(ctx); return 0; }