mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-18 12:01:16 -03:00
stop subclassing env_var_t from wcstring
This is the first step to implementing issue #4200 is to stop subclassing env_var_t from wcstring. Not too surprisingly doing this identified several places that were incorrectly treating env_var_t and wcstring as interchangeable types. I'm not talking about those places that passed an env_var_t instance to a function that takes a wcstring. I'm talking about doing things like assigning the former to the latter type, relying on the implicit conversion, and thus losing information. We also rename `env_get_string()` to `env_get()` for symmetry with `env_set()` and to make it clear the function does not return a string.
This commit is contained in:
@@ -78,7 +78,7 @@ static int load(const wcstring &name) {
|
||||
static void autoload_names(std::set<wcstring> &names, int get_hidden) {
|
||||
size_t i;
|
||||
|
||||
const env_var_t path_var_wstr = env_get_string(L"fish_function_path");
|
||||
const env_var_t path_var_wstr = env_get(L"fish_function_path");
|
||||
if (path_var_wstr.missing()) return;
|
||||
const wchar_t *path_var = path_var_wstr.c_str();
|
||||
|
||||
@@ -121,7 +121,7 @@ void function_init() {
|
||||
static std::map<wcstring, env_var_t> snapshot_vars(const wcstring_list_t &vars) {
|
||||
std::map<wcstring, env_var_t> result;
|
||||
for (wcstring_list_t::const_iterator it = vars.begin(), end = vars.end(); it != end; ++it) {
|
||||
result.insert(std::make_pair(*it, env_get_string(*it)));
|
||||
result.insert(std::make_pair(*it, env_get(*it)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user