diff options
author | LemonBoy <thatlemon@gmail.com> | 2016-06-12 23:39:22 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2016-06-12 23:39:22 +0200 |
commit | 6f795f020d5c374023dc9ca647b267aef0a76950 (patch) | |
tree | 38b22e5e62a8a53bfe26714563efc0923b78ef6e /src/fe-common | |
parent | 7307b48bd6928207ded9e186af3f3b97625f00bb (diff) | |
download | irssi-6f795f020d5c374023dc9ca647b267aef0a76950.zip |
Strip the surrounding whitespace.
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/fe-settings.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c index e25886ec..ca1f871d 100644 --- a/src/fe-common/core/fe-settings.c +++ b/src/fe-common/core/fe-settings.c @@ -67,6 +67,7 @@ static void set_print_pattern(const char *pattern) static void set_boolean(const char *key, const char *value) { char *stripped_value; + stripped_value = g_strdup(value); g_strstrip(stripped_value); @@ -79,7 +80,7 @@ static void set_boolean(const char *key, const char *value) else printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_NOT_TOGGLE); - g_free(stripped_value); + g_free(stripped_value); } static void set_int(const char *key, const char *value) @@ -99,6 +100,16 @@ static void set_int(const char *key, const char *value) settings_set_int(key, (int)longval); } +static void set_choice(const char *key, const char *value) +{ + char *stripped_value; + + stripped_value = g_strdup(value); + g_strstrip(stripped_value); + settings_set_choice(key, stripped_value); + g_free(stripped_value); +} + /* SYNTAX: SET [-clear | -default] [<key> [<value>]] */ static void cmd_set(char *data) { @@ -143,9 +154,10 @@ static void cmd_set(char *data) set_int(key, value); break; case SETTING_TYPE_CHOICE: - settings_set_choice(key, clear ? "" : - set_default ? rec->choices[rec->default_value.v_int] : - value); + if (clear || set_default) + settings_set_choice(key, rec->choices[rec->default_value.v_int]); + else + set_choice(key, value); break; case SETTING_TYPE_STRING: settings_set_str(key, clear ? "" : |