aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index b610ac463e..c14edd1a9c 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3971,10 +3971,8 @@ did_set_string_option (
if (errmsg == NULL) {
/* canonize the value, so that STRCMP() can be used on it */
p = enc_canonize(*varp);
- if (p != NULL) {
- free(*varp);
- *varp = p;
- }
+ free(*varp);
+ *varp = p;
if (varp == &p_enc) {
errmsg = mb_init();
redraw_titles();
@@ -4000,18 +3998,8 @@ did_set_string_option (
} else if (varp == &p_penc) {
/* Canonize printencoding if VIM standard one */
p = enc_canonize(p_penc);
- if (p != NULL) {
- free(p_penc);
- p_penc = p;
- } else {
- /* Ensure lower case and '-' for '_' */
- for (s = p_penc; *s != NUL; s++) {
- if (*s == '_')
- *s = '-';
- else
- *s = TOLOWER_ASC(*s);
- }
- }
+ free(p_penc);
+ p_penc = p;
} else if (varp == &curbuf->b_p_keymap) {
/* load or unload key mapping tables */
errmsg = keymap_init();