diff --git a/src/node.cc b/src/node.cc index 2c937b298ef70c..6cbf6b60fdc8f9 100644 --- a/src/node.cc +++ b/src/node.cc @@ -173,7 +173,7 @@ static node_module* modlist_builtin; static node_module* modlist_linked; static node_module* modlist_addon; static bool trace_enabled = false; -static const char* trace_enabled_categories = nullptr; +static std::string trace_enabled_categories; // NOLINT(runtime/string) #if defined(NODE_HAVE_I18N_SUPPORT) // Path to ICU data (for i18n / Intl) diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc index ceab09e5a2789c..669bae130c7f94 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc @@ -10,10 +10,11 @@ namespace node { namespace tracing { using v8::platform::tracing::TraceConfig; +using std::string; Agent::Agent() {} -void Agent::Start(v8::Platform* platform, const char* enabled_categories) { +void Agent::Start(v8::Platform* platform, const string& enabled_categories) { platform_ = platform; int err = uv_loop_init(&tracing_loop_); @@ -26,7 +27,7 @@ void Agent::Start(v8::Platform* platform, const char* enabled_categories) { tracing_controller_ = new TracingController(); TraceConfig* trace_config = new TraceConfig(); - if (enabled_categories) { + if (!enabled_categories.empty()) { std::stringstream category_list(enabled_categories); while (category_list.good()) { std::string category; diff --git a/src/tracing/agent.h b/src/tracing/agent.h index f6cb5af97f4bbc..2174d5b8965c2a 100644 --- a/src/tracing/agent.h +++ b/src/tracing/agent.h @@ -12,7 +12,7 @@ namespace tracing { class Agent { public: explicit Agent(); - void Start(v8::Platform* platform, const char* enabled_categories); + void Start(v8::Platform* platform, const std::string& enabled_categories); void Stop(); private: