1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

core: avoid reversing initialization order list

This commit is contained in:
Steffen Vogel 2022-10-28 11:32:18 -04:00
parent 3f8a38adce
commit 2a068ec3a6

View file

@ -76,15 +76,13 @@ CoreFactory::make(PCIeCard* card, json_t *json_ips)
// Pick out IPs to be initialized first.
//
// Reverse order of the initialization order list, because we push to the
// Reverse walktrough, because we push to the
// front of the output list, so that the first element will also be the
// first to be initialized.
vlnvInitializationOrder.reverse();
for (auto &vlnvInitFirst : vlnvInitializationOrder) {
for (auto viIt = vlnvInitializationOrder.rbegin(); viIt != vlnvInitializationOrder.rend(); ++viIt) {
// Iterate over IPs, if VLNV matches, push to front and remove from list
for (auto it = allIps.begin(); it != allIps.end(); ++it) {
if (vlnvInitFirst == it->getVlnv()) {
if (*viIt == it->getVlnv()) {
orderedIps.push_front(*it);
it = allIps.erase(it);
}