diff options
author | Adrian Szyndela <adrian.s@samsung.com> | 2020-12-11 09:06:08 +0100 |
---|---|---|
committer | Hyotaek Shim <hyotaek.shim@samsung.com> | 2020-12-11 10:28:40 +0000 |
commit | 3fa6c844dabfcbdee947eb558f526c889965b444 (patch) | |
tree | 6c6190a682689e3257cf496a2df2b5bec815be2a | |
parent | 7e357b033baac41efed09a4a021ca113b1c280d8 (diff) | |
download | libdbuspolicy-3fa6c844dabfcbdee947eb558f526c889965b444.tar.gz libdbuspolicy-3fa6c844dabfcbdee947eb558f526c889965b444.tar.bz2 libdbuspolicy-3fa6c844dabfcbdee947eb558f526c889965b444.zip |
refactoring: move getter out of loop and lambda
Change-Id: Iab7e249849a2ae3f61642b4ead9a973071287401
-rw-r--r-- | src/internal/storage_backend_serialized.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/internal/storage_backend_serialized.cpp b/src/internal/storage_backend_serialized.cpp index 5509e55..e19fe43 100644 --- a/src/internal/storage_backend_serialized.cpp +++ b/src/internal/storage_backend_serialized.cpp @@ -186,17 +186,17 @@ inline ldp_xml_parser::DecisionItem StorageBackendSerialized::getDecisionItem(co return getDecisionItem(item, policy, ldp_serialization::ItemsType()); // make it old way for old databases auto index = impl.policyGetIndex(policy); + auto db_items = impl.policyGetItems(policy); uint32_t currentBest = 0; - auto updateCurrentBest = [¤tBest, &item, &policy, this](const auto &vec) { + auto updateCurrentBest = [¤tBest, &item, &db_items, this](const auto &vec) { // look from the back, the rule is the same as for the full database // we now only check among less elements, because the database is indexed to small lists // item_scores are in increasing order in the index, and they serve also as ids of the policy rules for (auto item_score_it = impl.containerGetReverseIterator(vec); item_score_it != impl.containerGetReverseIteratorEnd(vec); item_score_it++) { - auto db_items = impl.policyGetItems(policy); auto db_item = impl.containerLookupByIndex(db_items, *item_score_it - 1); // rules are indexed/scored from 1 if (*item_score_it > currentBest && match(item, db_item)) { currentBest = *item_score_it; |