diff options
author | Famiu Haque <famiuhaque@proton.me> | 2023-06-07 06:05:16 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 08:05:16 +0800 |
commit | b3d5138fd0066fda26ef7724a542ae45eb42fc84 (patch) | |
tree | f9893af238d838408c81c6d4e36655865fe465b0 /src/nvim/spell.c | |
parent | 0370e4def0c0328f8cd09f02c1ca82ed491ecb9a (diff) | |
download | rneovim-b3d5138fd0066fda26ef7724a542ae45eb42fc84.tar.gz rneovim-b3d5138fd0066fda26ef7724a542ae45eb42fc84.tar.bz2 rneovim-b3d5138fd0066fda26ef7724a542ae45eb42fc84.zip |
refactor(options): remove `getoption_T` and introduce `OptVal` (#23850)
Removes the `getoption_T` struct and also introduces the `OptVal` struct
to unify the methods of getting/setting different option value types.
This is the first of many PRs to reduce code duplication in the Vim
option code as well as to make options easier to maintain. It also
increases the flexibility and extensibility of options. Which opens the
door for things like Array and Dictionary options.
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r-- | src/nvim/spell.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 5a1b3f1965..b337504bd9 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -3171,17 +3171,15 @@ void ex_spelldump(exarg_T *eap) if (no_spell_checking(curwin)) { return; } - char *spl; - long dummy; - (void)get_option_value("spl", &dummy, &spl, NULL, OPT_LOCAL); + OptVal spl = get_option_value("spl", NULL, OPT_LOCAL, NULL); // Create a new empty buffer in a new window. do_cmdline_cmd("new"); // enable spelling locally in the new window - set_option_value_give_err("spell", true, "", OPT_LOCAL); - set_option_value_give_err("spl", dummy, spl, OPT_LOCAL); - xfree(spl); + set_option_value_give_err("spell", BOOLEAN_OPTVAL(true), OPT_LOCAL); + set_option_value_give_err("spl", spl, OPT_LOCAL); + optval_free(spl); if (!buf_is_empty(curbuf)) { return; |