[binder] Replace NULL/0 with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
clang-tidy -checks=modernize-use-nullptr -p compile_commands.json -fix
...
Test: m
Bug: 68236239
Change-Id: I3181bc5683796423a98b0f9b94daf30880c07bdc
Merged-In: I3181bc5683796423a98b0f9b94daf30880c07bdc
(cherry picked from commit 91635563b8a1bf7a31e4ceb439728dacb79abd76)
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index ba9bf61..33ec65f 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -289,7 +289,7 @@
if (gShutdown) {
ALOGW("Calling IPCThreadState::self() during shutdown is dangerous, expect a crash.\n");
- return NULL;
+ return nullptr;
}
pthread_mutex_lock(&gTLSMutex);
@@ -299,7 +299,7 @@
pthread_mutex_unlock(&gTLSMutex);
ALOGW("IPCThreadState::self() unable to create TLS key, expect a crash: %s\n",
strerror(key_create_value));
- return NULL;
+ return nullptr;
}
gHaveTLS = true;
}
@@ -314,7 +314,7 @@
IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k);
return st;
}
- return NULL;
+ return nullptr;
}
void IPCThreadState::shutdown()
@@ -326,7 +326,7 @@
IPCThreadState* st = (IPCThreadState*)pthread_getspecific(gTLS);
if (st) {
delete st;
- pthread_setspecific(gTLS, NULL);
+ pthread_setspecific(gTLS, nullptr);
}
pthread_key_delete(gTLS);
gHaveTLS = false;
@@ -584,7 +584,7 @@
LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(),
(flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY");
- err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
+ err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, nullptr);
if (err != NO_ERROR) {
if (reply) reply->setError(err);
@@ -621,7 +621,7 @@
else alog << "(none requested)" << endl;
}
} else {
- err = waitForResponse(NULL, NULL);
+ err = waitForResponse(nullptr, nullptr);
}
return err;
@@ -725,7 +725,7 @@
err = writeTransactionData(BC_REPLY, flags, -1, 0, reply, &statusBuffer);
if (err < NO_ERROR) return err;
- return waitForResponse(NULL, NULL);
+ return waitForResponse(nullptr, nullptr);
}
status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
@@ -785,14 +785,14 @@
freeBuffer, this);
} else {
err = *reinterpret_cast<const status_t*>(tr.data.ptr.buffer);
- freeBuffer(NULL,
+ freeBuffer(nullptr,
reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
tr.data_size,
reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
tr.offsets_size/sizeof(binder_size_t), this);
}
} else {
- freeBuffer(NULL,
+ freeBuffer(nullptr,
reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
tr.data_size,
reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
@@ -1185,7 +1185,7 @@
alog << "Writing BC_FREE_BUFFER for " << data << endl;
}
ALOG_ASSERT(data != NULL, "Called with NULL data");
- if (parcel != NULL) parcel->closeFileDescriptors();
+ if (parcel != nullptr) parcel->closeFileDescriptors();
IPCThreadState* state = self();
state->mOut.writeInt32(BC_FREE_BUFFER);
state->mOut.writePointer((uintptr_t)data);