diff --git a/src/env.cpp b/src/env.cpp index 1a4080d7d..268234221 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -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 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)) { diff --git a/src/path.cpp b/src/path.cpp index 937738664..0a47f11ee 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -185,7 +185,7 @@ maybe_t 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); }