mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-28 13:11:15 -03:00
Revert "Optimize function calls by reducing inherit vars heap allocations and copies"
This reverts commit cdce8511a1.
This change was unsafe. The prior version (now restored) took the lock and
then copied the data. By returning a reference, the caller holds a
reference to data outside of the lock.
This function isn't worth optimizing. Hardly any functions use this
facility, and for those that do, they typically just capture one or two
variables.
This commit is contained in:
@@ -199,7 +199,7 @@ static wcstring functions_def(const wcstring &name) {
|
||||
}
|
||||
|
||||
// Output any inherited variables as `set -l` lines.
|
||||
const std::map<wcstring, env_var_t> &inherit_vars = function_get_inherit_vars(name);
|
||||
std::map<wcstring, env_var_t> inherit_vars = function_get_inherit_vars(name);
|
||||
for (const auto &kv : inherit_vars) {
|
||||
wcstring_list_t lst;
|
||||
kv.second.to_list(lst);
|
||||
|
||||
Reference in New Issue
Block a user