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: I81f6b220f0f01ce1cdc631aeb333c0a26edf9f58
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/lpcsnoop/snoop_listen.hpp b/lpcsnoop/snoop_listen.hpp
index 21bb01c..241ee4f 100644
--- a/lpcsnoop/snoop_listen.hpp
+++ b/lpcsnoop/snoop_listen.hpp
@@ -48,7 +48,7 @@
{}
SnoopListen(sdbusplus::bus_t& busIn, postcode_handler_t handler,
- FILE* f = NULL) :
+ FILE* f = nullptr) :
SnoopListen(busIn, std::bind(defaultMessageHandler, handler, f,
std::placeholders::_1))
{}
diff --git a/main.cpp b/main.cpp
index f4353d7..d4f4063 100644
--- a/main.cpp
+++ b/main.cpp
@@ -272,14 +272,14 @@
// clang-format off
static const struct option long_options[] = {
#ifdef ENABLE_IPMI_SNOOP
- {"host", optional_argument, NULL, 'h'},
+ {"host", optional_argument, nullptr, 'h'},
#else
- {"device", optional_argument, NULL, 'd'},
- {"rate-limit", optional_argument, NULL, 'r'},
- {"bytes", required_argument, NULL, 'b'},
+ {"device", optional_argument, nullptr, 'd'},
+ {"rate-limit", optional_argument, nullptr, 'r'},
+ {"bytes", required_argument, nullptr, 'b'},
#endif
- {"verbose", no_argument, NULL, 'v'},
- {0, 0, 0, 0}
+ {"verbose", no_argument, nullptr, 'v'},
+ {nullptr, 0, nullptr, 0}
};
// clang-format on
@@ -291,7 +291,8 @@
#endif
"v";
- while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1)
+ while ((opt = getopt_long(argc, argv, optstring, long_options, nullptr)) !=
+ -1)
{
switch (opt)
{