From 63717021457ce18645f736b0b8dc5bf49248b1ce Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 22 Sep 2023 13:53:45 +0100 Subject: [PATCH] Expose conf_clear(), for test purposes. Normally you don't ever want to have a Conf structure that doesn't have an entry for every primary key, because the code that uses Conf to get real work done will fail assertions if lookups fail. But test programs manipulating Conf in unusual ways are a special case. (In particular, one thing you _can_ legally do with an empty Conf is to call load_open_settings() to populate it. That has to be legal, because it's how a Conf gets populated in the first place, after it's initially created empty.) --- putty.h | 1 + utils/conf.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/putty.h b/putty.h index b8c8169f..6f118f7c 100644 --- a/putty.h +++ b/putty.h @@ -2056,6 +2056,7 @@ enum config_primary_key { CONFIG_OPTIONS(CONF_ENUM_DEF) N_CONFIG_OPTIONS }; /* Functions handling configuration structures. */ Conf *conf_new(void); /* create an empty configuration */ void conf_free(Conf *conf); +void conf_clear(Conf *conf); /* likely only useful for test programs */ Conf *conf_copy(Conf *oldconf); void conf_copy_into(Conf *dest, Conf *src); /* Mandatory accessor functions: enforce by assertion that keys exist. */ diff --git a/utils/conf.c b/utils/conf.c index 53195180..2f9093b0 100644 --- a/utils/conf.c +++ b/utils/conf.c @@ -211,7 +211,7 @@ Conf *conf_new(void) return conf; } -static void conf_clear(Conf *conf) +void conf_clear(Conf *conf) { struct conf_entry *entry;