clang-tidy: Replace NULL with nullptr
Replaced all instances of NULL with nullptr to improve type safety
and clarity, as nullptr is the modern C++ standard for null pointers.
Tested: Build verified
Change-Id: If9e6c34c48821a7cf8577a2166727ce7db06fadc
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/libpldmresponder/pdr.cpp b/libpldmresponder/pdr.cpp
index 9a149f7..0d2d12a 100644
--- a/libpldmresponder/pdr.cpp
+++ b/libpldmresponder/pdr.cpp
@@ -16,8 +16,8 @@
{
uint8_t* pdrData = nullptr;
uint32_t pdrSize{};
- auto record = pldm_pdr_find_record_by_type(inRepo.getPdr(), pdrType, NULL,
- &pdrData, &pdrSize);
+ auto record = pldm_pdr_find_record_by_type(inRepo.getPdr(), pdrType,
+ nullptr, &pdrData, &pdrSize);
while (record)
{
PdrEntry pdrEntry{};
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index b8ac0f6..2329213 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -241,7 +241,7 @@
{
pdr_utils::PdrEntry e;
auto record = pdr::getRecordByHandle(pdrRepo, recordHandle, e);
- if (record == NULL)
+ if (record == nullptr)
{
return CmdHandler::ccOnlyResponse(
request, PLDM_PLATFORM_INVALID_RECORD_HANDLE);
@@ -455,7 +455,7 @@
previousEventState);
// If there are no HOST PDR's, there is no further action
- if (hostPDRHandler == NULL)
+ if (hostPDRHandler == nullptr)
{
return PLDM_SUCCESS;
}
@@ -866,7 +866,7 @@
while (pdrRecord)
{
pdr = reinterpret_cast<pldm_state_sensor_pdr*>(pdrEntry.data);
- assert(pdr != NULL);
+ assert(pdr != nullptr);
if (pdr->sensor_id != sensorId)
{
pdr = nullptr;
@@ -938,7 +938,7 @@
while (pdrRecord)
{
pdr = reinterpret_cast<pldm_state_effecter_pdr*>(pdrEntry.data);
- assert(pdr != NULL);
+ assert(pdr != nullptr);
if (pdr->effecter_id != effecterId)
{
pdr = nullptr;
diff --git a/libpldmresponder/platform_state_sensor.hpp b/libpldmresponder/platform_state_sensor.hpp
index 20973b9..003763f 100644
--- a/libpldmresponder/platform_state_sensor.hpp
+++ b/libpldmresponder/platform_state_sensor.hpp
@@ -110,7 +110,7 @@
while (pdrRecord)
{
pdr = reinterpret_cast<pldm_state_sensor_pdr*>(pdrEntry.data);
- assert(pdr != NULL);
+ assert(pdr != nullptr);
if (pdr->sensor_id != sensorId)
{
pdr = nullptr;
diff --git a/libpldmresponder/test/libpldmresponder_fru_test.cpp b/libpldmresponder/test/libpldmresponder_fru_test.cpp
index f4a1202..8eba53d 100644
--- a/libpldmresponder/test/libpldmresponder_fru_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_fru_test.cpp
@@ -136,21 +136,21 @@
pldm_entity_node* node =
pldm_entity_association_tree_find(entityTree.get(), &systemEntity);
- EXPECT_TRUE(node != NULL);
+ EXPECT_TRUE(node != nullptr);
node = pldm_entity_association_tree_find(entityTree.get(), &chassisEntity);
- ASSERT_TRUE(node != NULL);
+ ASSERT_TRUE(node != nullptr);
test_pldm_entity_node* test_node = (test_pldm_entity_node*)node;
EXPECT_TRUE((test_node->parent).entity_type == systemEntity.entity_type);
node =
pldm_entity_association_tree_find(entityTree.get(), &motherboardEntity);
- ASSERT_TRUE(node != NULL);
+ ASSERT_TRUE(node != nullptr);
test_node = (test_pldm_entity_node*)node;
EXPECT_TRUE((test_node->parent).entity_type == chassisEntity.entity_type);
node = pldm_entity_association_tree_find(entityTree.get(), &panelEntity);
- EXPECT_TRUE(node == NULL);
+ EXPECT_TRUE(node == nullptr);
}
TEST(FruImpl, entityByObjectPath)