Skip to content

Commit b1dcaad

Browse files
committed
src: replace NULL with nullptr in debug agent
Update the debug agent to conform to the code style in src/.
1 parent 084f382 commit b1dcaad

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/debug-agent.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Agent::Agent(Environment* env) : state_(kNone),
5555
port_(5858),
5656
wait_(false),
5757
parent_env_(env),
58-
child_env_(NULL),
59-
dispatch_handler_(NULL) {
58+
child_env_(nullptr),
59+
dispatch_handler_(nullptr) {
6060
int err;
6161

6262
err = uv_sem_init(&start_sem_, 0);
@@ -117,7 +117,7 @@ bool Agent::Start(int port, bool wait) {
117117
return true;
118118

119119
thread_create_failed:
120-
uv_close(reinterpret_cast<uv_handle_t*>(&child_signal_), NULL);
120+
uv_close(reinterpret_cast<uv_handle_t*>(&child_signal_), nullptr);
121121

122122
async_init_failed:
123123
err = uv_loop_close(&child_loop_);
@@ -144,10 +144,10 @@ void Agent::Stop() {
144144
return;
145145
}
146146

147-
v8::Debug::SetMessageHandler(NULL);
147+
v8::Debug::SetMessageHandler(nullptr);
148148

149149
// Send empty message to terminate things
150-
EnqueueMessage(new AgentMessage(NULL, 0));
150+
EnqueueMessage(new AgentMessage(nullptr, 0));
151151

152152
// Signal worker thread to make it stop
153153
err = uv_async_send(&child_signal_);
@@ -156,7 +156,7 @@ void Agent::Stop() {
156156
err = uv_thread_join(&thread_);
157157
CHECK_EQ(err, 0);
158158

159-
uv_close(reinterpret_cast<uv_handle_t*>(&child_signal_), NULL);
159+
uv_close(reinterpret_cast<uv_handle_t*>(&child_signal_), nullptr);
160160
uv_run(&child_loop_, UV_RUN_NOWAIT);
161161

162162
err = uv_loop_close(&child_loop_);
@@ -202,7 +202,7 @@ void Agent::WorkerRun() {
202202
env->CleanupHandles();
203203

204204
env->Dispose();
205-
env = NULL;
205+
env = nullptr;
206206
}
207207
isolate->Dispose();
208208
}
@@ -263,7 +263,7 @@ void Agent::SendCommand(const FunctionCallbackInfo<Value>& args) {
263263
String::Value v(args[0]);
264264

265265
v8::Debug::SendCommand(a->parent_env()->isolate(), *v, v.length());
266-
if (a->dispatch_handler_ != NULL)
266+
if (a->dispatch_handler_ != nullptr)
267267
a->dispatch_handler_(a->parent_env());
268268
}
269269

@@ -286,11 +286,11 @@ void Agent::ChildSignalCb(uv_async_t* signal) {
286286
AgentMessage* msg = ContainerOf(&AgentMessage::member, q);
287287

288288
// Time to close everything
289-
if (msg->data() == NULL) {
289+
if (msg->data() == nullptr) {
290290
QUEUE_REMOVE(q);
291291
delete msg;
292292

293-
MakeCallback(isolate, api, "onclose", 0, NULL);
293+
MakeCallback(isolate, api, "onclose", 0, nullptr);
294294
break;
295295
}
296296

@@ -331,7 +331,7 @@ void Agent::MessageHandler(const v8::Debug::Message& message) {
331331
Isolate* isolate = message.GetIsolate();
332332
Environment* env = Environment::GetCurrent(isolate);
333333
Agent* a = env->debugger_agent();
334-
CHECK_NE(a, NULL);
334+
CHECK_NE(a, nullptr);
335335
CHECK_EQ(isolate, a->parent_env()->isolate());
336336

337337
HandleScope scope(isolate);

src/debug-agent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Agent {
108108
class AgentMessage {
109109
public:
110110
AgentMessage(uint16_t* val, int length) : length_(length) {
111-
if (val == NULL) {
111+
if (val == nullptr) {
112112
data_ = val;
113113
} else {
114114
data_ = new uint16_t[length];
@@ -118,7 +118,7 @@ class AgentMessage {
118118

119119
~AgentMessage() {
120120
delete[] data_;
121-
data_ = NULL;
121+
data_ = nullptr;
122122
}
123123

124124
inline const uint16_t* data() const { return data_; }

0 commit comments

Comments
 (0)