mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
refactor(options): remove set_string_option_direct()
Problem: `set_string_option_direct()` contains a separate codepath specifically for setting string options. Not only is that unnecessary code duplication, but it's also limited to only string options. Solution: Replace `set_string_option_direct()` with `set_option_direct()` which calls `set_option()` under the hood. This reduces code duplication and allows directly setting an option of any type.
This commit is contained in:
@@ -1620,7 +1620,7 @@ failed:
|
||||
save_file_ff(curbuf);
|
||||
// If editing a new file: set 'fenc' for the current buffer.
|
||||
// Also for ":read ++edit file".
|
||||
set_string_option_direct(kOptFileencoding, fenc, OPT_LOCAL, 0);
|
||||
set_option_direct(kOptFileencoding, CSTR_AS_OPTVAL(fenc), OPT_LOCAL, 0);
|
||||
}
|
||||
if (fenc_alloced) {
|
||||
xfree(fenc);
|
||||
@@ -1968,7 +1968,7 @@ void set_forced_fenc(exarg_T *eap)
|
||||
}
|
||||
|
||||
char *fenc = enc_canonize(eap->cmd + eap->force_enc);
|
||||
set_string_option_direct(kOptFileencoding, fenc, OPT_LOCAL, 0);
|
||||
set_option_direct(kOptFileencoding, CSTR_AS_OPTVAL(fenc), OPT_LOCAL, 0);
|
||||
xfree(fenc);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user