Skip to content

Commit cc31d8b

Browse files
committed
src: remove public API for option variables
PR-URL: #23069 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent d527dde commit cc31d8b

File tree

6 files changed

+10
-57
lines changed

6 files changed

+10
-57
lines changed

src/node.cc

+2-24
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ bool SafeGetenv(const char* key, std::string* text) {
610610

611611

612612
void* ArrayBufferAllocator::Allocate(size_t size) {
613-
if (zero_fill_field_ || zero_fill_all_buffers)
613+
if (zero_fill_field_ || per_process_opts->zero_fill_all_buffers)
614614
return UncheckedCalloc(size);
615615
else
616616
return UncheckedMalloc(size);
@@ -1920,8 +1920,7 @@ void SetupProcessObject(Environment* env,
19201920
}
19211921

19221922
// --no-deprecation
1923-
// TODO(addaleax): Uncomment the commented part.
1924-
if (/*env->options()->*/no_deprecation) {
1923+
if (env->options()->no_deprecation) {
19251924
READONLY_PROPERTY(process, "noDeprecation", True(env->isolate()));
19261925
}
19271926

@@ -2442,16 +2441,6 @@ inline void PlatformInit() {
24422441
#endif // _WIN32
24432442
}
24442443

2445-
// TODO(addaleax): Remove, both from the public API and in implementation.
2446-
bool no_deprecation = false;
2447-
#if HAVE_OPENSSL
2448-
bool ssl_openssl_cert_store = false;
2449-
#if NODE_FIPS_MODE
2450-
bool enable_fips_crypto = false;
2451-
bool force_fips_crypto = false;
2452-
#endif
2453-
#endif
2454-
24552444
void ProcessArgv(std::vector<std::string>* args,
24562445
std::vector<std::string>* exec_args,
24572446
bool is_env) {
@@ -2535,17 +2524,6 @@ void ProcessArgv(std::vector<std::string>* args,
25352524
if (v8_args_as_char_ptr.size() > 1) {
25362525
exit(9);
25372526
}
2538-
2539-
// TODO(addaleax): Remove.
2540-
zero_fill_all_buffers = per_process_opts->zero_fill_all_buffers;
2541-
no_deprecation = per_process_opts->per_isolate->per_env->no_deprecation;
2542-
#if HAVE_OPENSSL
2543-
ssl_openssl_cert_store = per_process_opts->ssl_openssl_cert_store;
2544-
#if NODE_FIPS_MODE
2545-
enable_fips_crypto = per_process_opts->enable_fips_crypto;
2546-
force_fips_crypto = per_process_opts->force_fips_crypto;
2547-
#endif
2548-
#endif
25492527
}
25502528

25512529

src/node.h

-14
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,6 @@ typedef intptr_t ssize_t;
202202

203203
namespace node {
204204

205-
// TODO(addaleax): Remove all of these.
206-
NODE_DEPRECATED("use command-line flags",
207-
NODE_EXTERN extern bool no_deprecation);
208-
#if HAVE_OPENSSL
209-
NODE_DEPRECATED("use command-line flags",
210-
NODE_EXTERN extern bool ssl_openssl_cert_store);
211-
# if NODE_FIPS_MODE
212-
NODE_DEPRECATED("use command-line flags",
213-
NODE_EXTERN extern bool enable_fips_crypto);
214-
NODE_DEPRECATED("user command-line flags",
215-
NODE_EXTERN extern bool force_fips_crypto);
216-
# endif
217-
#endif
218-
219205
// TODO(addaleax): Officially deprecate this and replace it with something
220206
// better suited for a public embedder API.
221207
NODE_EXTERN int Start(int argc, char* argv[]);

src/node_buffer.cc

+3-5
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,12 @@
5656

5757
namespace node {
5858

59-
// if true, all Buffer and SlowBuffer instances will automatically zero-fill
60-
bool zero_fill_all_buffers = false;
61-
6259
namespace {
6360

6461
inline void* BufferMalloc(size_t length) {
65-
return zero_fill_all_buffers ? node::UncheckedCalloc(length) :
66-
node::UncheckedMalloc(length);
62+
return per_process_opts->zero_fill_all_buffers ?
63+
node::UncheckedCalloc(length) :
64+
node::UncheckedMalloc(length);
6765
}
6866

6967
} // namespace

src/node_buffer.h

-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727

2828
namespace node {
2929

30-
// TODO(addaleax): Remove this.
31-
NODE_DEPRECATED("use command-line flags",
32-
extern bool zero_fill_all_buffers);
33-
3430
namespace Buffer {
3531

3632
static const unsigned int kMaxLength = v8::TypedArray::kMaxLength;

src/node_config.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void Initialize(Local<Object> target,
5656
#ifdef NODE_FIPS_MODE
5757
READONLY_BOOLEAN_PROPERTY("fipsMode");
5858
// TODO(addaleax): Use options parser variable instead.
59-
if (force_fips_crypto)
59+
if (per_process_opts->force_fips_crypto)
6060
READONLY_BOOLEAN_PROPERTY("fipsForced");
6161
#endif
6262

src/node_crypto.cc

+4-9
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,7 @@ static X509_STORE* NewRootCertStore() {
751751
if (*system_cert_path != '\0') {
752752
X509_STORE_load_locations(store, system_cert_path, nullptr);
753753
}
754-
// TODO(addaleax): Replace `ssl_openssl_cert_store` with
755-
// `per_process_opts->ssl_openssl_cert_store`.
756-
if (ssl_openssl_cert_store) {
754+
if (per_process_opts->ssl_openssl_cert_store) {
757755
X509_STORE_set_default_paths(store);
758756
} else {
759757
for (X509* cert : root_certs_vector) {
@@ -5585,10 +5583,8 @@ void InitCryptoOnce() {
55855583
#ifdef NODE_FIPS_MODE
55865584
/* Override FIPS settings in cnf file, if needed. */
55875585
unsigned long err = 0; // NOLINT(runtime/int)
5588-
// TODO(addaleax): Use commented part instead.
5589-
/*if (per_process_opts->enable_fips_crypto ||
5590-
per_process_opts->force_fips_crypto) {*/
5591-
if (enable_fips_crypto || force_fips_crypto) {
5586+
if (per_process_opts->enable_fips_crypto ||
5587+
per_process_opts->force_fips_crypto) {
55925588
if (0 == FIPS_mode() && !FIPS_mode_set(1)) {
55935589
err = ERR_get_error();
55945590
}
@@ -5651,8 +5647,7 @@ void GetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
56515647
}
56525648

56535649
void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
5654-
// TODO(addaleax): Use options parser variables instead.
5655-
CHECK(!force_fips_crypto);
5650+
CHECK(!per_process_opts->force_fips_crypto);
56565651
Environment* env = Environment::GetCurrent(args);
56575652
const bool enabled = FIPS_mode();
56585653
bool enable;

0 commit comments

Comments
 (0)