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.
This commit is contained in:
Famiu Haque
2023-06-07 06:05:16 +06:00
committed by GitHub
parent 0370e4def0
commit b3d5138fd0
29 changed files with 683 additions and 378 deletions

View File

@@ -2250,7 +2250,7 @@ void save_clear_shm_value(void)
if (++set_shm_recursive == 1) {
STRCPY(shm_buf, p_shm);
set_option_value_give_err("shm", 0L, "", 0);
set_option_value_give_err("shm", STATIC_CSTR_AS_OPTVAL(""), 0);
}
}
@@ -2258,7 +2258,7 @@ void save_clear_shm_value(void)
void restore_shm_value(void)
{
if (--set_shm_recursive == 0) {
set_option_value_give_err("shm", 0L, shm_buf, 0);
set_option_value_give_err("shm", CSTR_AS_OPTVAL(shm_buf), 0);
memset(shm_buf, 0, SHM_LEN);
}
}