mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 09:56:31 +00:00
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:
@@ -143,9 +143,8 @@ bool ctx_restore(Context *ctx, const int flags)
|
||||
free_ctx = true;
|
||||
}
|
||||
|
||||
char *op_shada;
|
||||
get_option_value("shada", NULL, &op_shada, NULL, OPT_GLOBAL);
|
||||
set_option_value("shada", 0L, "!,'100,%", OPT_GLOBAL);
|
||||
OptVal op_shada = get_option_value("shada", NULL, OPT_GLOBAL, NULL);
|
||||
set_option_value("shada", STATIC_CSTR_AS_OPTVAL("!,'100,%"), OPT_GLOBAL);
|
||||
|
||||
if (flags & kCtxRegs) {
|
||||
ctx_restore_regs(ctx);
|
||||
@@ -171,8 +170,8 @@ bool ctx_restore(Context *ctx, const int flags)
|
||||
ctx_free(ctx);
|
||||
}
|
||||
|
||||
set_option_value("shada", 0L, op_shada, OPT_GLOBAL);
|
||||
xfree(op_shada);
|
||||
set_option_value("shada", op_shada, OPT_GLOBAL);
|
||||
optval_free(op_shada);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user