diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-06-16 20:27:25 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-06-16 20:27:25 -0400 |
commit | d199d18159c624844c9c8052d1a98b91084fb803 (patch) | |
tree | 827dd9c4f8f1f6ef73ff1f20a609d08e36640986 /src/nvim/option.c | |
parent | 8bbeb4b480a72d0099a18c4d8200313600045231 (diff) | |
parent | e85598e5a91c714c10034b6b3986a666065d1078 (diff) | |
download | rneovim-d199d18159c624844c9c8052d1a98b91084fb803.tar.gz rneovim-d199d18159c624844c9c8052d1a98b91084fb803.tar.bz2 rneovim-d199d18159c624844c9c8052d1a98b91084fb803.zip |
Merge #787 'removal of redundant OOM error handling'
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 5690d2c61f..8390efe979 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(); @@ -7396,10 +7384,9 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u *** return OK; } -int ExpandOldSetting(int *num_file, char_u ***file) +void ExpandOldSetting(int *num_file, char_u ***file) { - char_u *var = NULL; /* init for GCC */ - char_u *buf; + char_u *var = NULL; *num_file = 0; *file = (char_u **)xmalloc(sizeof(char_u *)); @@ -7422,13 +7409,7 @@ int ExpandOldSetting(int *num_file, char_u ***file) /* A backslash is required before some characters. This is the reverse of * what happens in do_set(). */ - buf = vim_strsave_escaped(var, escape_chars); - - if (buf == NULL) { - free(*file); - *file = NULL; - return FAIL; - } + char_u *buf = vim_strsave_escaped(var, escape_chars); #ifdef BACKSLASH_IN_FILENAME /* For MS-Windows et al. we don't double backslashes at the start and @@ -7444,7 +7425,6 @@ int ExpandOldSetting(int *num_file, char_u ***file) *file[0] = buf; *num_file = 1; - return OK; } /* |