use std::move in a couple spots where things were unsed after copy

This commit is contained in:
Aaron Gyes 2019-04-04 14:16:34 -07:00
parent 09e8f0fd7c
commit b064eaa571
2 changed files with 5 additions and 5 deletions

View File

@ -195,7 +195,7 @@ struct var_stack_t {
}
node->next = this->top;
this->top = node;
this->top = std::move(node);
if (new_scope && local_scope_exports(this->top)) {
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;
env_node_ref_t preexisting_node = get_node(key);
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);
assert(result != preexisting_node->env.end());
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;
} else if (var_mode & ENV_LOCAL) {
node = vars_stack().top;
} else if (preexisting_node != NULL) {
node = preexisting_node;
} else if (preexisting_node != nullptr) {
node = std::move(preexisting_node);
if ((var_mode & (ENV_EXPORT | ENV_UNEXPORT)) == 0) {
// Use existing entry's exportv status.
if (preexisting_flags && (*preexisting_flags & env_var_t::flag_export)) {

View File

@ -185,7 +185,7 @@ maybe_t<wcstring> path_get_cdpath(const wcstring &dir, const wcstring &wd,
expand_tilde(next_path, env_vars);
if (next_path.empty()) continue;
wcstring whole_path = next_path;
wcstring whole_path = std::move(next_path);
append_path_component(whole_path, dir);
paths.push_back(whole_path);
}