Skip to content

Commit 8d893f2

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 005363a commit 8d893f2

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/env.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,9 @@ Environment::Environment(IsolateData* isolate_data,
172172
immediate_info_(context->GetIsolate()),
173173
tick_info_(context->GetIsolate()),
174174
timer_base_(uv_now(isolate_data->event_loop())),
175-
printed_error_(false),
176-
abort_on_uncaught_exception_(false),
177-
emit_env_nonstring_warning_(true),
178-
emit_err_name_warning_(true),
179-
makecallback_cntr_(0),
180175
should_abort_on_uncaught_toggle_(isolate_, 1),
181176
trace_category_state_(isolate_, kTraceCategoryCount),
182177
stream_base_state_(isolate_, StreamBase::kNumStreamBaseStateFields),
183-
http_parser_buffer_(nullptr),
184178
fs_stats_field_array_(isolate_, kFsStatsBufferLength),
185179
fs_stats_field_bigint_array_(isolate_, kFsStatsBufferLength),
186180
context_(context->GetIsolate(), context) {

src/env.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,11 +950,11 @@ class Environment {
950950
ImmediateInfo immediate_info_;
951951
TickInfo tick_info_;
952952
const uint64_t timer_base_;
953-
bool printed_error_;
954-
bool abort_on_uncaught_exception_;
955-
bool emit_env_nonstring_warning_;
956-
bool emit_err_name_warning_;
957-
size_t makecallback_cntr_;
953+
bool printed_error_ = false;
954+
bool abort_on_uncaught_exception_ = false;
955+
bool emit_env_nonstring_warning_ = true;
956+
bool emit_err_name_warning_ = true;
957+
size_t makecallback_cntr_ = 0;
958958
std::vector<double> destroy_async_id_list_;
959959

960960
std::shared_ptr<EnvironmentOptions> options_;
@@ -1010,7 +1010,7 @@ class Environment {
10101010
double* heap_statistics_buffer_ = nullptr;
10111011
double* heap_space_statistics_buffer_ = nullptr;
10121012

1013-
char* http_parser_buffer_;
1013+
char* http_parser_buffer_ = nullptr;
10141014
bool http_parser_buffer_in_use_ = false;
10151015
std::unique_ptr<http2::Http2State> http2_state_;
10161016

0 commit comments

Comments
 (0)