[logd] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I15ccb9cfc9967dae4320d9690f5097bc2f7d5bfe
diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp
index 27cd9a8..4ea7877 100644
--- a/logd/LogAudit.cpp
+++ b/logd/LogAudit.cpp
@@ -171,13 +171,13 @@
}
int LogAudit::logPrint(const char* fmt, ...) {
- if (fmt == NULL) {
+ if (fmt == nullptr) {
return -EINVAL;
}
va_list args;
- char* str = NULL;
+ char* str = nullptr;
va_start(args, fmt);
int rc = vasprintf(&str, fmt, args);
va_end(args);
@@ -228,7 +228,7 @@
static char* last_str;
static bool last_info;
- if (last_str != NULL) {
+ if (last_str != nullptr) {
static const char avc[] = "): avc: ";
char* avcl = strstr(last_str, avc);
bool skip = false;
@@ -265,10 +265,10 @@
writev(fdDmesg, iov, arraysize(iov));
free(last_str);
- last_str = NULL;
+ last_str = nullptr;
}
}
- if (last_str == NULL) {
+ if (last_str == nullptr) {
count = 0;
last_str = strdup(str);
last_info = info;
@@ -357,7 +357,7 @@
static const char comm_str[] = " comm=\"";
const char* comm = strstr(str, comm_str);
const char* estr = str + strlen(str);
- const char* commfree = NULL;
+ const char* commfree = nullptr;
if (comm) {
estr = comm;
comm += sizeof(comm_str) - 1;