Skip to content

Commit 1563488

Browse files
committed
src: clarify OptionEnvvarSettings member names
The term `Environment` in `kAllowedInEnvironment` and `kDisallowedInEnvironment` has nothing to do with the commonly used term `node::Environment`. Rename the member to `kAllowedInEnvvar` and `kDisallowedInEnvvar` respectively to reflect they are options of `OptionEnvvarSettings`. As `OptionEnvvarSettings` is part of the public embedder APIs, the legacy names are still preserved.
1 parent 9878c26 commit 1563488

6 files changed

+161
-162
lines changed

src/node.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -769,15 +769,15 @@ static ExitCode InitializeNodeWithArgsInternal(
769769
env_argv.insert(env_argv.begin(), argv->at(0));
770770

771771
const ExitCode exit_code = ProcessGlobalArgsInternal(
772-
&env_argv, nullptr, errors, kAllowedInEnvironment);
772+
&env_argv, nullptr, errors, kAllowedInEnvvar);
773773
if (exit_code != ExitCode::kNoFailure) return exit_code;
774774
}
775775
}
776776
#endif
777777

778778
if (!(flags & ProcessInitializationFlags::kDisableCLIOptions)) {
779-
const ExitCode exit_code = ProcessGlobalArgsInternal(
780-
argv, exec_argv, errors, kDisallowedInEnvironment);
779+
const ExitCode exit_code =
780+
ProcessGlobalArgsInternal(argv, exec_argv, errors, kDisallowedInEnvvar);
781781
if (exit_code != ExitCode::kNoFailure) return exit_code;
782782
}
783783

src/node.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,12 @@ inline std::unique_ptr<InitializationResult> InitializeOncePerProcess(
349349
}
350350

351351
enum OptionEnvvarSettings {
352-
kAllowedInEnvironment,
353-
kDisallowedInEnvironment
352+
kAllowedInEnvvar = 0,
353+
kDisallowedInEnvvar = 1,
354+
// Deprecated, use kAllowedInEnvvar instead.
355+
kAllowedInEnvironment = kAllowedInEnvvar,
356+
// Deprecated, use kDisallowedInEnvvar instead.
357+
kDisallowedInEnvironment = kDisallowedInEnvvar,
354358
};
355359

356360
NODE_EXTERN int ProcessGlobalArgs(std::vector<std::string>* args,

src/node_options-inl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void OptionsParser<Options>::Parse(
302302
const std::string arg = args.pop_first();
303303

304304
if (arg == "--") {
305-
if (required_env_settings == kAllowedInEnvironment)
305+
if (required_env_settings == kAllowedInEnvvar)
306306
errors->push_back(NotAllowedInEnvErr("--"));
307307
break;
308308
}
@@ -374,8 +374,8 @@ void OptionsParser<Options>::Parse(
374374
auto it = options_.find(name);
375375

376376
if ((it == options_.end() ||
377-
it->second.env_setting == kDisallowedInEnvironment) &&
378-
required_env_settings == kAllowedInEnvironment) {
377+
it->second.env_setting == kDisallowedInEnvvar) &&
378+
required_env_settings == kAllowedInEnvvar) {
379379
errors->push_back(NotAllowedInEnvErr(original_name));
380380
break;
381381
}

0 commit comments

Comments
 (0)