env: Use preexisting_flags to determine pathiness

We've already checked if the variable exists above, and we've already
gotten the preexisting_flags, so we can just use them.

Saves a lookup.
This commit is contained in:
Fabian Homborg 2018-11-04 17:02:04 +01:00
parent 9afc4b419e
commit a7ec158373

View file

@ -1147,8 +1147,8 @@ static int env_set_internal(const wcstring &key, env_mode_flags_t input_var_mode
// If there's an existing variable, use its path flag; otherwise infer it.
if ((var_mode & (ENV_PATHVAR | ENV_UNPATHVAR)) == 0) {
bool should_pathvar = false;
if (auto existing = node->find_entry(key)) {
should_pathvar = existing->is_pathvar();
if (preexisting_flags) {
should_pathvar = *preexisting_flags & env_var_t::flag_pathvar;
} else {
should_pathvar = variable_should_auto_pathvar(key);
}