mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-07-03 09:51:13 -03:00
Use move semantics instead of swap in env_set
This commit backs out certain optimizations around setting environment variables, and replaces them with move semantics. env_set accepts a list, by value, permitting callers to use std::move to transfer ownership.
This commit is contained in:
@@ -345,7 +345,7 @@ void function_prepare_environment(const wcstring &name, const wchar_t *const *ar
|
||||
// It should be impossible for the var to be missing since we're inheriting it from an outer
|
||||
// scope. So we now die horribly if it is missing.
|
||||
assert(!it->second.missing());
|
||||
wcstring_list_t vals = it->second.as_const_list(); // we need a copy
|
||||
wcstring_list_t vals = it->second.as_list(); // we need a copy
|
||||
env_set(it->first, ENV_LOCAL | ENV_USER, vals); // because this mutates the list
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user