Skip to content

Commit d1ff107

Browse files
committed
src: initialize Environment members in class definition
Initialize primitive members of `Environment` in the class definition for clarity. PR-URL: #25369 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 071f84e commit d1ff107

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/env.cc

-6
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,9 @@ Environment::Environment(IsolateData* isolate_data,
171171
immediate_info_(context->GetIsolate()),
172172
tick_info_(context->GetIsolate()),
173173
timer_base_(uv_now(isolate_data->event_loop())),
174-
printed_error_(false),
175-
abort_on_uncaught_exception_(false),
176-
emit_env_nonstring_warning_(true),
177-
emit_err_name_warning_(true),
178-
makecallback_cntr_(0),
179174
should_abort_on_uncaught_toggle_(isolate_, 1),
180175
trace_category_state_(isolate_, kTraceCategoryCount),
181176
stream_base_state_(isolate_, StreamBase::kNumStreamBaseStateFields),
182-
http_parser_buffer_(nullptr),
183177
fs_stats_field_array_(isolate_, kFsStatsBufferLength),
184178
fs_stats_field_bigint_array_(isolate_, kFsStatsBufferLength),
185179
context_(context->GetIsolate(), context) {

src/env.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -945,11 +945,11 @@ class Environment {
945945
ImmediateInfo immediate_info_;
946946
TickInfo tick_info_;
947947
const uint64_t timer_base_;
948-
bool printed_error_;
949-
bool abort_on_uncaught_exception_;
950-
bool emit_env_nonstring_warning_;
951-
bool emit_err_name_warning_;
952-
size_t makecallback_cntr_;
948+
bool printed_error_ = false;
949+
bool abort_on_uncaught_exception_ = false;
950+
bool emit_env_nonstring_warning_ = true;
951+
bool emit_err_name_warning_ = true;
952+
size_t makecallback_cntr_ = 0;
953953
std::vector<double> destroy_async_id_list_;
954954

955955
std::shared_ptr<EnvironmentOptions> options_;
@@ -1004,7 +1004,7 @@ class Environment {
10041004
double* heap_statistics_buffer_ = nullptr;
10051005
double* heap_space_statistics_buffer_ = nullptr;
10061006

1007-
char* http_parser_buffer_;
1007+
char* http_parser_buffer_ = nullptr;
10081008
bool http_parser_buffer_in_use_ = false;
10091009
std::unique_ptr<http2::Http2State> http2_state_;
10101010

0 commit comments

Comments
 (0)