pldm: prefer empty() over size() == 0 Prefer container.empty() over container.size() == 0 for clarity and consistency with the rest of the codebase. empty() directly expresses intent and follows common C++ container usage conventions. Change-Id: Ia1beac941428d420b2c02a68cd66ea1732f9f989 Signed-off-by: Meghana Vangapandu <meghanav@ami.com>
diff --git a/libpldmresponder/event_parser.cpp b/libpldmresponder/event_parser.cpp index 5158eda..7a57d15 100644 --- a/libpldmresponder/event_parser.cpp +++ b/libpldmresponder/event_parser.cpp
@@ -84,7 +84,7 @@ auto eventStates = entry.value("event_states", emptyJsonList); auto propertyValues = dbus.value("property_values", emptyJsonList); - if ((eventStates.size() == 0) || (propertyValues.size() == 0) || + if (eventStates.empty() || propertyValues.empty() || (eventStates.size() != propertyValues.size())) { error(
diff --git a/libpldmresponder/platform_numeric_effecter.hpp b/libpldmresponder/platform_numeric_effecter.hpp index 3116542..52bfaac 100644 --- a/libpldmresponder/platform_numeric_effecter.hpp +++ b/libpldmresponder/platform_numeric_effecter.hpp
@@ -537,7 +537,7 @@ { const auto& [dbusMappings, dbusValMaps] = handler.getDbusObjMaps(effecterId); - if (dbusMappings.size() > 0) + if (!dbusMappings.empty()) { dbusMapping = { dbusMappings[0].objectPath, dbusMappings[0].interface,
diff --git a/pldmtool/pldm_base_cmd.cpp b/pldmtool/pldm_base_cmd.cpp index 1073f4c..4199184 100644 --- a/pldmtool/pldm_base_cmd.cpp +++ b/pldmtool/pldm_base_cmd.cpp
@@ -418,7 +418,7 @@ sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_REQ_BYTES); auto request = new (requestMsg.data()) pldm_msg; ver32_t version{0xFF, 0xFF, 0xFF, 0xFF}; - if (inputVersion.size() != 0) + if (!inputVersion.empty()) { if (inputVersion.size() != 4) {
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp index f741211..4ad6a66 100644 --- a/softoff/softoff.cpp +++ b/softoff/softoff.cpp
@@ -231,7 +231,7 @@ ResponseMsg.read(Response); - if (Response.size() == 0) + if (Response.empty()) { error( "No State Sensor PDR found for TID={TID}, EntityType={ENTITY_TYPE}, StateSetId={STATE_SET}",