[cmds] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I1635395d653ace5a11c75795f4a7d2bf2d9e0b1b
Merged-In: I73a0a82e3e32001f8ffb0880250c7023dd8290d3
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 3af8121..5061745 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -63,7 +63,7 @@
/* read before root is shed */
static char cmdline_buf[16384] = "(unknown)";
-static const char *dump_traces_path = NULL;
+static const char *dump_traces_path = nullptr;
// TODO: variables and functions below should be part of dumpstate object
@@ -267,7 +267,7 @@
char path[PATH_MAX];
d = opendir(driverpath);
- if (d == NULL) {
+ if (d == nullptr) {
return;
}
@@ -559,7 +559,7 @@
static int dump_stat_from_fd(const char *title __unused, const char *path, int fd) {
unsigned long long fields[__STAT_NUMBER_FIELD];
bool z;
- char *cp, *buffer = NULL;
+ char *cp, *buffer = nullptr;
size_t i = 0;
FILE *fp = fdopen(dup(fd), "rb");
getline(&buffer, &i, fp);
@@ -1362,7 +1362,7 @@
| O_CLOEXEC | O_NOFOLLOW)));
if (fd == -1) {
MYLOGE("open(%s): %s\n", filepath.c_str(), strerror(errno));
- return NULL;
+ return nullptr;
}
SHA256_CTX ctx;
@@ -1375,7 +1375,7 @@
break;
} else if (bytes_read == -1) {
MYLOGE("read(%s): %s\n", filepath.c_str(), strerror(errno));
- return NULL;
+ return nullptr;
}
SHA256_Update(&ctx, buffer.data(), bytes_read);
@@ -1423,7 +1423,7 @@
int do_add_date = 0;
int do_zip_file = 0;
int do_vibrate = 1;
- char* use_outfile = 0;
+ char* use_outfile = nullptr;
int use_socket = 0;
int use_control_socket = 0;
int do_fb = 0;