aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/autocmd.c
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-02-03 12:57:03 +0600
committerFamiu Haque <famiuhaque@proton.me>2024-03-21 15:41:14 +0600
commit2214f9c19daa46a1fc37bcc14c017c092894a506 (patch)
tree5fd933cd67d5d868a4c876dcc20af263e3d4ddfc /src/nvim/autocmd.c
parent5aa8c02a9de5c1efa1e2dee60af1ecf58f452d19 (diff)
downloadrneovim-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/autocmd.c')
-rw-r--r--src/nvim/autocmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 285ef538b9..00cfef23c7 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -712,7 +712,7 @@ char *au_event_disable(char *what)
} else {
STRCAT(new_ei, what);
}
- set_string_option_direct(kOptEventignore, new_ei, 0, SID_NONE);
+ set_option_direct(kOptEventignore, CSTR_AS_OPTVAL(new_ei), 0, SID_NONE);
xfree(new_ei);
return save_ei;
}
@@ -720,7 +720,7 @@ char *au_event_disable(char *what)
void au_event_restore(char *old_ei)
{
if (old_ei != NULL) {
- set_string_option_direct(kOptEventignore, old_ei, 0, SID_NONE);
+ set_option_direct(kOptEventignore, CSTR_AS_OPTVAL(old_ei), 0, SID_NONE);
xfree(old_ei);
}
}