Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I4e29baf95b16942b22bbd15c50aa956f5decf241
diff --git a/AccessControl.cpp b/AccessControl.cpp
index 93d78e2..0c73dc6 100644
--- a/AccessControl.cpp
+++ b/AccessControl.cpp
@@ -22,7 +22,7 @@
AccessControl::AccessControl() {
mSeHandle = selinux_android_hw_service_context_handle();
- LOG_ALWAYS_FATAL_IF(mSeHandle == NULL, "Failed to acquire SELinux handle.");
+ LOG_ALWAYS_FATAL_IF(mSeHandle == nullptr, "Failed to acquire SELinux handle.");
if (getcon(&mSeContext) != 0) {
LOG_ALWAYS_FATAL("Failed to acquire hwservicemanager context.");
@@ -64,7 +64,7 @@
}
Context AccessControl::getContext(pid_t sourcePid) {
- char *sourceContext = NULL;
+ char *sourceContext = nullptr;
if (getpidcon(sourcePid, &sourceContext) < 0) {
ALOGE("SELinux: failed to retrieve process context for pid %d", sourcePid);
@@ -92,7 +92,7 @@
}
bool AccessControl::checkPermission(const Context &context, pid_t sourceAuditPid, const char *perm, const char *interface) {
- char *targetContext = NULL;
+ char *targetContext = nullptr;
bool allowed = false;
// Lookup service in hwservice_contexts