mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09:18:19 +00:00
refactor(options): use hashy for finding options (#26573)
Problem: `findoption()` searches through the options[] table linearly for option names, even though hashy can be used to generate a compile-time hash table for it. Solution: Use hashy to generate a compile time hash table for finding options. This also allows handling option aliases, so we don't need separate options[] table entries for things like 'viminfo'.
This commit is contained in:
@@ -643,7 +643,7 @@ static Object get_option_from(void *from, OptReqScope req_scope, String name, Er
|
||||
return (Object)OBJECT_INIT;
|
||||
});
|
||||
|
||||
OptVal value = get_option_value_strict(findoption(name.data), req_scope, from, err);
|
||||
OptVal value = get_option_value_strict(find_option(name.data), req_scope, from, err);
|
||||
if (ERROR_SET(err)) {
|
||||
return (Object)OBJECT_INIT;
|
||||
}
|
||||
@@ -669,7 +669,7 @@ static void set_option_to(uint64_t channel_id, void *to, OptReqScope req_scope,
|
||||
return;
|
||||
});
|
||||
|
||||
OptIndex opt_idx = findoption(name.data);
|
||||
OptIndex opt_idx = find_option(name.data);
|
||||
VALIDATE_S(opt_idx != kOptInvalid, "option name", name.data, {
|
||||
return;
|
||||
});
|
||||
|
Reference in New Issue
Block a user