clang-tidy: Enable readability-redundant-string-cstr check

This check finds unnecessary calls to std::string::c_str() and
std::string::data().

Change-Id: I43e747b95eb042650668da7dd57a8d4b8463426a
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index fed8f0d..462941c 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -261,6 +261,7 @@
 readability-redundant-member-init,
 readability-redundant-preprocessor,
 readability-redundant-smartptr-get,
+readability-redundant-string-cstr,
 readability-redundant-string-init,
 readability-simplify-boolean-expr,
 readability-simplify-subscript-expr,
diff --git a/discover_system_state.cpp b/discover_system_state.cpp
index 892fb6c..53a414f 100644
--- a/discover_system_state.cpp
+++ b/discover_system_state.cpp
@@ -86,7 +86,7 @@
     auto bmcRebootCause =
         sdbusplus::message::convert_from_string<BMC::RebootCause>(
             phosphor::state::manager::utils::getProperty(
-                bus, bmcPath.str.c_str(), BMC_BUSNAME, "LastRebootCause"));
+                bus, bmcPath.str, BMC_BUSNAME, "LastRebootCause"));
 
     if (bmcRebootCause == BMC::RebootCause::PinholeReset)
     {
@@ -141,8 +141,8 @@
             // to default for next time.
             info("One time set, use it and reset to default");
             phosphor::state::manager::utils::setProperty(
-                bus, settings.powerRestorePolicyOneTime.c_str(),
-                powerRestoreIntf, "PowerRestorePolicy",
+                bus, settings.powerRestorePolicyOneTime, powerRestoreIntf,
+                "PowerRestorePolicy",
                 convertForMessage(RestorePolicy::Policy::None));
         }
 
diff --git a/host_condition_gpio/host_condition_main.cpp b/host_condition_gpio/host_condition_main.cpp
index ad23a87..5caffe5 100644
--- a/host_condition_gpio/host_condition_main.cpp
+++ b/host_condition_gpio/host_condition_main.cpp
@@ -29,7 +29,7 @@
     sdbusplus::server::manager_t objManager(bus, objGroupName.c_str());
 
     // For now, we only support checking Host0 status
-    phosphor::condition::Host host(bus, objPathInst.c_str(), hostId);
+    phosphor::condition::Host host(bus, objPathInst, hostId);
 
     bus.request_name(busName.c_str());
 
diff --git a/utils.cpp b/utils.cpp
index 0df843b..8ebe270 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -242,7 +242,7 @@
     auto bmcPath = sdbusplus::message::object_path(BMC::namespace_path::value) /
                    BMC::namespace_path::bmc;
 
-    auto bmcState = getProperty(bus, bmcPath.str.c_str(), BMC::interface,
+    auto bmcState = getProperty(bus, bmcPath.str, BMC::interface,
                                 "CurrentBMCState");
 
     if (sdbusplus::message::convert_from_string<BMC::BMCState>(bmcState) !=