]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmbconf: in text backend, put flushing of the cache into a helper function.
authorMichael Adam <obnox@samba.org>
Wed, 26 Mar 2008 22:11:04 +0000 (23:11 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 26 Mar 2008 23:32:09 +0000 (00:32 +0100)
And use it also in the close operation.

Michael

source/lib/smbconf/smbconf_txt_simple.c

index 4bd3eeeb2b789a74bd592d77fa8caea87cc76eb2..f149a1623c2f779b1423429088c6fcd2f6b7626b 100644 (file)
@@ -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;
 }