diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-02-03 12:57:03 +0600 |
---|---|---|
committer | Famiu Haque <famiuhaque@proton.me> | 2024-03-21 15:41:14 +0600 |
commit | 2214f9c19daa46a1fc37bcc14c017c092894a506 (patch) | |
tree | 5fd933cd67d5d868a4c876dcc20af263e3d4ddfc /src/nvim/statusline.c | |
parent | 5aa8c02a9de5c1efa1e2dee60af1ecf58f452d19 (diff) | |
download | rneovim-2214f9c19daa46a1fc37bcc14c017c092894a506.tar.gz rneovim-2214f9c19daa46a1fc37bcc14c017c092894a506.tar.bz2 rneovim-2214f9c19daa46a1fc37bcc14c017c092894a506.zip |
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.
Diffstat (limited to 'src/nvim/statusline.c')
-rw-r--r-- | src/nvim/statusline.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index 1d914dd105..ca7083a9e3 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -2187,7 +2187,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op // matter? // if (called_emsg > called_emsg_before) if (opt_idx != kOptInvalid && did_emsg > did_emsg_before) { - set_string_option_direct(opt_idx, "", opt_scope, SID_ERROR); + set_option_direct(opt_idx, STATIC_CSTR_AS_OPTVAL(""), opt_scope, SID_ERROR); } // A user function may reset KeyTyped, restore it. |