clang-tidy: Enable modernize-use-nullptr
Modified code to address issues flagged by this check.
Tested: Build and unit tests passed successfully.
Change-Id: I25f984d06a2dbdeb65d64fe8f90929b2af1ea796
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/dump_offload.cpp b/dump_offload.cpp
index 188f901..e53afd3 100644
--- a/dump_offload.cpp
+++ b/dump_offload.cpp
@@ -52,8 +52,8 @@
FD_SET(socket, &writeFileDescriptor);
int nextFileDescriptor = socket + 1;
- int retVal = select(nextFileDescriptor, NULL, &writeFileDescriptor,
- NULL, &timeVal);
+ int retVal = select(nextFileDescriptor, nullptr, &writeFileDescriptor,
+ nullptr, &timeVal);
if (retVal <= 0)
{
lg2::error("writeOnUnixSocket: select() failed, errno: {ERRNO}",
@@ -157,7 +157,7 @@
FD_SET(unixSocket(), &readFD);
int numOfFDs = unixSocket() + 1;
- int retVal = select(numOfFDs, &readFD, NULL, NULL, &timeVal);
+ int retVal = select(numOfFDs, &readFD, nullptr, nullptr, &timeVal);
if (retVal <= 0)
{
lg2::error("select() failed, errno: {ERRNO}, DUMP_ID: {DUMP_ID}",
@@ -167,7 +167,7 @@
}
else if ((retVal > 0) && (FD_ISSET(unixSocket(), &readFD)))
{
- CustomFd socketFD = accept(unixSocket(), NULL, NULL);
+ CustomFd socketFD = accept(unixSocket(), nullptr, nullptr);
if (socketFD() < 0)
{
lg2::error(
diff --git a/test/debug_inif_test.cpp b/test/debug_inif_test.cpp
index 08cb2a7..59472ef 100644
--- a/test/debug_inif_test.cpp
+++ b/test/debug_inif_test.cpp
@@ -23,7 +23,7 @@
std::span<char> tmpdirSpan(reinterpret_cast<char*>(tmpdir),
sizeof(tmpdir));
auto dirPtr = mkdtemp(tmpdirSpan.data());
- if (dirPtr == NULL)
+ if (dirPtr == nullptr)
{
throw std::bad_alloc();
}