argument: Fix clang-tidy readability-redundant-string-init
```
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../argument.cpp:30:35: error: redundant string initialization [readability-redundant-string-init,-warnings-as-errors]
const std::string ArgumentParser::empty_string = "";
^~~~~~~~~~~~~~~~~
empty_string
```
Change-Id: I6b802d85b6f0ac0911e3ce85f086e8df29239f37
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/argument.cpp b/argument.cpp
index fd0c50d..c7d6043 100644
--- a/argument.cpp
+++ b/argument.cpp
@@ -27,7 +27,6 @@
{
const std::string ArgumentParser::true_string = "true";
-const std::string ArgumentParser::empty_string = "";
const char* ArgumentParser::optionstr = "p:?h";
const option ArgumentParser::options[] = {
@@ -59,10 +58,12 @@
const std::string& ArgumentParser::operator[](const std::string& opt)
{
+ static const std::string emptyString{};
+
auto i = arguments.find(opt);
if (i == arguments.end())
{
- return empty_string;
+ return emptyString;
}
else
{
diff --git a/argument.hpp b/argument.hpp
index 81876da..040b022 100644
--- a/argument.hpp
+++ b/argument.hpp
@@ -39,9 +39,6 @@
/** @brief Set to 'true' when an option is passed */
static const std::string true_string;
- /** @brief Set to '' when an option is not passed */
- static const std::string empty_string;
-
private:
/** @brief Option to argument mapping */
std::map<const std::string, std::string> arguments;
diff --git a/controller.cpp b/controller.cpp
index a694b3d..8219ef3 100644
--- a/controller.cpp
+++ b/controller.cpp
@@ -91,7 +91,7 @@
// Parse out Path argument.
auto path = std::move((options)["path"]);
- if (path == phosphor::led::ArgumentParser::empty_string)
+ if (path.empty())
{
ExitWithError("Path not specified.", argv);
}