diff options
author | 2018-06-07 17:52:27 -0700 | |
---|---|---|
committer | 2018-06-07 17:54:21 -0700 | |
commit | fdd8da9e3f79be25b91293e22114c177c3b3fd8d (patch) | |
tree | cbc9fea00e9b67d631bde2bbb70de5b151dfcadc /libs/binder/IPCThreadState.cpp | |
parent | a160f5a70ffba3715c8a92f4f469922d59635356 (diff) |
[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)
Diffstat (limited to 'libs/binder/IPCThreadState.cpp')
-rw-r--r-- | libs/binder/IPCThreadState.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index ba9bf61f8c..33ec65f10e 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -289,7 +289,7 @@ restart: 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 @@ restart: 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* IPCThreadState::selfOrNull() IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k); return st; } - return NULL; + return nullptr; } void IPCThreadState::shutdown() @@ -326,7 +326,7 @@ void IPCThreadState::shutdown() 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 @@ status_t IPCThreadState::transact(int32_t handle, 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 @@ status_t IPCThreadState::transact(int32_t handle, else alog << "(none requested)" << endl; } } else { - err = waitForResponse(NULL, NULL); + err = waitForResponse(nullptr, nullptr); } return err; @@ -725,7 +725,7 @@ status_t IPCThreadState::sendReply(const Parcel& reply, uint32_t flags) 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 @@ status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult) 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 @@ void IPCThreadState::freeBuffer(Parcel* parcel, const uint8_t* data, 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); |