mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
settings.c: allow load_open_settings(NULL).
All the lowest-level helper functions in settings.c that read a single setting from a settings_r are now prepared to tolerate being passed a null settings_r pointer, which will be treated as if reading from it always failed. This means you can call load_open_settings(NULL, conf) to populate a Conf with all of the _built-in_ internal defaults, without ever loading from the saved-session storage at all (not even Default Settings). (Doing this will still call the platform_default_foo function family, if nothing else because Filenames and FontSpecs can't be constructed in any platform-independent way at all.)
This commit is contained in:
parent
dfb8d5da52
commit
1b2f39c24b
@ -107,7 +107,7 @@ char *get_remote_username(Conf *conf)
|
||||
|
||||
static char *gpps_raw(settings_r *sesskey, const char *name, const char *def)
|
||||
{
|
||||
char *ret = read_setting_s(sesskey, name);
|
||||
char *ret = sesskey ? read_setting_s(sesskey, name) : NULL;
|
||||
if (!ret)
|
||||
ret = platform_default_s(name);
|
||||
if (!ret)
|
||||
@ -131,7 +131,7 @@ static void gpps(settings_r *sesskey, const char *name, const char *def,
|
||||
static void gppfont(settings_r *sesskey, char *name,
|
||||
Conf *conf, int primary)
|
||||
{
|
||||
FontSpec *result = read_setting_fontspec(sesskey, name);
|
||||
FontSpec *result = sesskey ? read_setting_fontspec(sesskey, name) : NULL;
|
||||
if (!result)
|
||||
result = platform_default_fontspec(name);
|
||||
conf_set_fontspec(conf, primary, result);
|
||||
@ -140,7 +140,7 @@ static void gppfont(settings_r *sesskey, char *name,
|
||||
static void gppfile(settings_r *sesskey, const char *name,
|
||||
Conf *conf, int primary)
|
||||
{
|
||||
Filename *result = read_setting_filename(sesskey, name);
|
||||
Filename *result = sesskey ? read_setting_filename(sesskey, name) : NULL;
|
||||
if (!result)
|
||||
result = platform_default_filename(name);
|
||||
conf_set_filename(conf, primary, result);
|
||||
@ -150,7 +150,7 @@ static void gppfile(settings_r *sesskey, const char *name,
|
||||
static int gppi_raw(settings_r *sesskey, const char *name, int def)
|
||||
{
|
||||
def = platform_default_i(name, def);
|
||||
return read_setting_i(sesskey, name, def);
|
||||
return sesskey ? read_setting_i(sesskey, name, def) : def;
|
||||
}
|
||||
|
||||
static void gppi(settings_r *sesskey, const char *name, int def,
|
||||
|
Loading…
Reference in New Issue
Block a user