mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 08:48:16 +00:00
refactor: replace unnecessary helper functions in optionstr.c
Replaces unnecessary helper functions in `optionstr.c` such as `get_option_flags()`, `get_option_fullname()`, `set_option_flag()`, `is_global_option()`, etc. with a single `get_option()` helper function that allows direct access to the `options` array. Also refactors `f_exists()` to use `get_varp_scope` instead of using `get_option_tv`. This opens up the path for removing `getoptions_T` altogether later down the line since the hidden option logic is no longer needed.
This commit is contained in:
@@ -3659,7 +3659,6 @@ static int eval_index(char **arg, typval_T *rettv, int evaluate, int verbose)
|
||||
int get_option_tv(const char **const arg, typval_T *const rettv, const bool evaluate)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
bool working = (**arg == '+'); // has("+option")
|
||||
int opt_flags;
|
||||
|
||||
// Isolate the option name and find its value.
|
||||
@@ -3704,10 +3703,6 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = stringval;
|
||||
}
|
||||
} else if (working && (opt_type == gov_hidden_bool
|
||||
|| opt_type == gov_hidden_number
|
||||
|| opt_type == gov_hidden_string)) {
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
*option_end = c; // put back for error messages
|
||||
|
Reference in New Issue
Block a user