Attn: Code cleanup based on local CI build output
Modified code based on recommendations from local CI build. Cleaned up
some potential null pointer dereferencing code.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I17fb40b25ce37627627c5112a6be786e2bac7c1f
diff --git a/listener.cpp b/listener.cpp
index 5360d81..9d3a05a 100644
--- a/listener.cpp
+++ b/listener.cpp
@@ -14,13 +14,6 @@
/** @brief end of command line args message */
static const char* msg_send_end = "999999999999999";
-/** @brief structure for holding main args (for threads) */
-typedef struct
-{
- int argc;
- char** argv;
-} MainArgs_t;
-
/**
* @brief Start a thread to monitor the attention GPIO
*
@@ -89,10 +82,8 @@
// convert messages to command line arguments
std::vector<char*> argv;
- for (const auto& arg : messages)
- {
- argv.push_back((char*)arg.data());
- }
+ std::transform(messages.begin(), messages.end(),
+ std::back_inserter(argv), (char*)data());
int argc = argv.size();
argv.push_back(nullptr);