aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/env.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/env.cpp b/src/env.cpp
index 28ea51b0..c24280bc 100644
--- a/src/env.cpp
+++ b/src/env.cpp
@@ -450,6 +450,7 @@ void env_init(const struct config_paths_t *paths /* or NULL */)
*/
/* Import environment variables. Walk backwards so that the first one out of any duplicates wins (#2784) */
+ wcstring key, val;
const char * const * envp = (environ ? environ : __environ);
size_t i = 0;
while (envp && envp[i])
@@ -468,9 +469,9 @@ void env_init(const struct config_paths_t *paths /* or NULL */)
}
else
{
- wcstring key = key_and_val.substr(0, eql);
+ key.assign(key_and_val, 0, eql);
if (is_read_only(key) || is_electric(key)) continue;
- wcstring val = key_and_val.substr(eql + 1);
+ val.assign(key_and_val, eql + 1, wcstring::npos);
if (variable_is_colon_delimited_array(key))
{
std::replace(val.begin(), val.end(), L':', ARRAY_SEP);