Stop using env_var_t::to_list in a few places

We don't need the entire list in modifiable form here - some just needs
the size, the others can just get a reference.
This commit is contained in:
Fabian Homborg
2020-12-15 15:26:38 +01:00
parent b0dcfac2a0
commit 0f6669f43c
4 changed files with 18 additions and 17 deletions

View File

@@ -138,8 +138,9 @@ wcstring_list_t path_get_paths(const wcstring &cmd, const environment_t &vars) {
}
auto path_var = vars.get(L"PATH");
wcstring_list_t pathsv;
if (path_var) path_var->to_list(pathsv);
if (!path_var) return paths;
const wcstring_list_t &pathsv = path_var->as_list();
for (auto path : pathsv) {
if (path.empty()) continue;
append_path_component(path, cmd);