From 1c8ad296b9e11b39da5acd1cdd9c71861fb6d67b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 26 Mar 2008 23:11:04 +0100 Subject: libsmbconf: in text backend, put flushing of the cache into a helper function. And use it also in the close operation. Michael (This used to be commit 8cb288124993eb59459e7e9777c65e58c0554d55) --- source3/lib/smbconf/smbconf_txt_simple.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/smbconf/smbconf_txt_simple.c b/source3/lib/smbconf/smbconf_txt_simple.c index 4bd3eeeb2b..f149a1623c 100644 --- a/source3/lib/smbconf/smbconf_txt_simple.c +++ b/source3/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; } -- cgit