From a7ec158373a52e69eb61124dc3f11180ad547024 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 4 Nov 2018 17:02:04 +0100 Subject: [PATCH] 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. --- src/env.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/env.cpp b/src/env.cpp index 9cc438867..d04d211c6 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -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); }