Correct code that combined assignment with condition test.
authorJon A. Cruz <jonc@osg.samsung.com>
Wed, 17 Jun 2015 03:11:58 +0000 (20:11 -0700)
committerUze Choi <uzchoi@samsung.com>
Thu, 18 Jun 2015 02:05:11 +0000 (02:05 +0000)
Combining assignment with an if() condition test is prone to
errors in maintenance, triggers compile warnings and complicates
debugging.

Also fixed missing EOL at EOF.

Change-Id: I6691fdc4de915c5c95d0fa58997398e6028beaa6
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1290
Reviewed-by: Younghyun Joo <yh_.joo@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/protocol-plugin/plugin-manager/src/Config.cpp

index 65062c0..9d8ec9b 100644 (file)
@@ -133,9 +133,9 @@ PMRESULT Config::parsing(char *xmlData, xml_document<> *doc)
 
 PMRESULT Config::getXmlData(xml_node<> *pluginInfo, std::string key)
 {
-    xml_attribute<> *iAttr = NULL;
     std::string value  = "";
-    if (iAttr = pluginInfo->first_attribute(key.c_str()))
+    xml_attribute<> *iAttr = pluginInfo->first_attribute(key.c_str());
+    if (iAttr)
     {
         value = iAttr->value();
         setValue(key, value);
@@ -201,4 +201,4 @@ std::string Config::getPluginPath()
     {
         return "";
     }
-}
\ No newline at end of file
+}