Use move semantics instead of swap in env_set

This commit backs out certain optimizations around setting environment
variables, and replaces them with move semantics. env_set accepts a
list,  by value, permitting callers to use std::move to transfer
ownership.
This commit is contained in:
ridiculousfish
2017-08-28 02:51:34 -07:00
parent 75dd852340
commit 4baada25b9
10 changed files with 59 additions and 119 deletions

View File

@@ -652,8 +652,7 @@ static void set_argparse_result_vars(argparse_cmd_opts_t &opts) {
if (!opt_spec->num_seen) continue;
if (opt_spec->short_flag_valid) {
env_set(var_name_prefix + opt_spec->short_flag, ENV_LOCAL, opt_spec->vals,
opt_spec->long_flag.empty());
env_set(var_name_prefix + opt_spec->short_flag, ENV_LOCAL, opt_spec->vals);
}
if (!opt_spec->long_flag.empty()) {
// We do a simple replacement of all non alphanum chars rather than calling