Enforce const correctness
For all async calls, we should be consistently capturing non trivial
objects by const reference. This corrects bmcweb to be consistent and
capture errors by const value, and objects by const reference.
Tested: Code compiles. Trivial changes.
This saves about 300 bytes on our compressed binary size.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib3e0b6edef9803a1c480701556949488406305d4
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 844b60d..a682486 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -223,8 +223,9 @@
BMCWEB_LOG_DEBUG << "Get Virtual Media resource data.";
crow::connections::systemBus->async_method_call(
- [resName, name, aResp](const boost::system::error_code ec,
- dbus::utility::ManagedObjectType& subtree) {
+ [resName, name,
+ aResp](const boost::system::error_code ec,
+ const dbus::utility::ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -232,7 +233,7 @@
return;
}
- for (auto& item : subtree)
+ for (const auto& item : subtree)
{
std::string thispath = item.first.filename();
if (thispath.empty())