diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-11-14 15:29:50 -0600 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2017-12-04 10:05:01 -0600 |
commit | d5cfdbe0240f9a5cb0d29fa6e384ad19b2b32cf3 (patch) | |
tree | b90fe9e91888bd3447556fce230eb7b2f1ea71e7 | |
parent | 5856023d05c6b26020675cce5ce6eca85460bec2 (diff) | |
download | phosphor-fan-presence-d5cfdbe0240f9a5cb0d29fa6e384ad19b2b32cf3.tar.gz phosphor-fan-presence-d5cfdbe0240f9a5cb0d29fa6e384ad19b2b32cf3.zip |
Update string compares on signal messages
Resulting from a code review, remove the use of strcmp when comparing a
string to a const char*
Change-Id: Idcd3f99bf7ca0151f5f1b97c7ccc54d6e8c56f8e
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
-rw-r--r-- | control/functor.hpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/control/functor.hpp b/control/functor.hpp index faf0d3e..de04226 100644 --- a/control/functor.hpp +++ b/control/functor.hpp @@ -82,10 +82,10 @@ struct PropertyChanged if (msg) { std::map<std::string, sdbusplus::message::variant<T>> properties; - const char* iface = nullptr; + std::string iface; msg.read(iface); - if (!iface || strcmp(iface, _iface)) + if (iface != _iface) { return; } @@ -197,8 +197,7 @@ struct InterfaceAdded sdbusplus::message::object_path op; msg.read(op); - auto objPath = static_cast<const std::string&>(op).c_str(); - if (!objPath || strcmp(objPath, _path)) + if (static_cast<const std::string&>(op) != _path) { // Object path does not match this handler's path return; |