Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: use std::string for trace enabled_categories #12242

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/tracing/agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down