1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

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.)
This commit is contained in:
Simon Tatham 2023-09-22 13:53:45 +01:00
parent cfdff822c4
commit 6371702145
2 changed files with 2 additions and 1 deletions

View File

@ -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. */

View File

@ -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;