PerformScan: Extract applyConfigExposeActions()
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I92bc8bbf591421b97f599e3ff82c7b77598022c3
diff --git a/src/PerformScan.cpp b/src/PerformScan.cpp
index 51228b5..c64968c 100644
--- a/src/PerformScan.cpp
+++ b/src/PerformScan.cpp
@@ -364,6 +364,26 @@
}
}
+static void applyConfigExposeActions(std::vector<std::string>& matches,
+ nlohmann::json& expose,
+ const std::string& propertyName,
+ nlohmann::json& configList)
+{
+ for (auto& exposedObject : configList)
+ {
+ auto match = findExposeActionRecord(matches, exposedObject);
+ if (!match)
+ {
+ continue;
+ }
+
+ matches.erase(*match);
+
+ applyBindExposeAction(exposedObject, expose, propertyName);
+ applyDisableExposeAction(exposedObject, propertyName);
+ }
+}
+
void PerformScan::run()
{
boost::container::flat_set<std::string> dbusProbeInterfaces;
@@ -579,22 +599,9 @@
continue;
}
- for (auto& exposedObject : *configListFind)
- {
- auto match = findExposeActionRecord(
- matches, exposedObject);
- if (!match)
- {
- continue;
- }
-
- matches.erase(*match);
-
- applyBindExposeAction(exposedObject, expose,
- keyPair.key());
- applyDisableExposeAction(exposedObject,
- keyPair.key());
- }
+ applyConfigExposeActions(matches, expose,
+ keyPair.key(),
+ *configListFind);
}
if (!matches.empty())
{