mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +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:
@@ -988,8 +988,10 @@ Buffer nvim_create_buf(Boolean listed, Boolean scratch, Error *err)
|
||||
buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
|
||||
|
||||
if (scratch) {
|
||||
set_string_option_direct_in_buf(buf, kOptBufhidden, "hide", OPT_LOCAL, 0);
|
||||
set_string_option_direct_in_buf(buf, kOptBuftype, "nofile", OPT_LOCAL, 0);
|
||||
set_option_direct_for(kOptBufhidden, STATIC_CSTR_AS_OPTVAL("hide"), OPT_LOCAL, 0, kOptReqBuf,
|
||||
buf);
|
||||
set_option_direct_for(kOptBuftype, STATIC_CSTR_AS_OPTVAL("nofile"), OPT_LOCAL, 0, kOptReqBuf,
|
||||
buf);
|
||||
assert(buf->b_ml.ml_mfp->mf_fd < 0); // ml_open() should not have opened swapfile already
|
||||
buf->b_p_swf = false;
|
||||
buf->b_p_ml = false;
|
||||
|
Reference in New Issue
Block a user