mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-02 22:57:24 +08:00
use std::move in a couple spots where things were unsed after copy
This commit is contained in:
parent
09e8f0fd7c
commit
b064eaa571
@ -195,7 +195,7 @@ struct var_stack_t {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node->next = this->top;
|
node->next = this->top;
|
||||||
this->top = node;
|
this->top = std::move(node);
|
||||||
if (new_scope && local_scope_exports(this->top)) {
|
if (new_scope && local_scope_exports(this->top)) {
|
||||||
this->mark_changed_exported();
|
this->mark_changed_exported();
|
||||||
}
|
}
|
||||||
@ -1160,7 +1160,7 @@ int env_stack_t::set_internal(const wcstring &key, env_mode_flags_t input_var_mo
|
|||||||
bool has_changed_new = false;
|
bool has_changed_new = false;
|
||||||
env_node_ref_t preexisting_node = get_node(key);
|
env_node_ref_t preexisting_node = get_node(key);
|
||||||
maybe_t<env_var_t::env_var_flags_t> preexisting_flags{};
|
maybe_t<env_var_t::env_var_flags_t> preexisting_flags{};
|
||||||
if (preexisting_node != NULL) {
|
if (preexisting_node != nullptr) {
|
||||||
var_table_t::const_iterator result = preexisting_node->env.find(key);
|
var_table_t::const_iterator result = preexisting_node->env.find(key);
|
||||||
assert(result != preexisting_node->env.end());
|
assert(result != preexisting_node->env.end());
|
||||||
preexisting_flags = result->second.get_flags();
|
preexisting_flags = result->second.get_flags();
|
||||||
@ -1174,8 +1174,8 @@ int env_stack_t::set_internal(const wcstring &key, env_mode_flags_t input_var_mo
|
|||||||
node = vars_stack().global_env;
|
node = vars_stack().global_env;
|
||||||
} else if (var_mode & ENV_LOCAL) {
|
} else if (var_mode & ENV_LOCAL) {
|
||||||
node = vars_stack().top;
|
node = vars_stack().top;
|
||||||
} else if (preexisting_node != NULL) {
|
} else if (preexisting_node != nullptr) {
|
||||||
node = preexisting_node;
|
node = std::move(preexisting_node);
|
||||||
if ((var_mode & (ENV_EXPORT | ENV_UNEXPORT)) == 0) {
|
if ((var_mode & (ENV_EXPORT | ENV_UNEXPORT)) == 0) {
|
||||||
// Use existing entry's exportv status.
|
// Use existing entry's exportv status.
|
||||||
if (preexisting_flags && (*preexisting_flags & env_var_t::flag_export)) {
|
if (preexisting_flags && (*preexisting_flags & env_var_t::flag_export)) {
|
||||||
|
@ -185,7 +185,7 @@ maybe_t<wcstring> path_get_cdpath(const wcstring &dir, const wcstring &wd,
|
|||||||
expand_tilde(next_path, env_vars);
|
expand_tilde(next_path, env_vars);
|
||||||
if (next_path.empty()) continue;
|
if (next_path.empty()) continue;
|
||||||
|
|
||||||
wcstring whole_path = next_path;
|
wcstring whole_path = std::move(next_path);
|
||||||
append_path_component(whole_path, dir);
|
append_path_component(whole_path, dir);
|
||||||
paths.push_back(whole_path);
|
paths.push_back(whole_path);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user