From 2a068ec3a6a5746707398b89b6510702eb497625 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 28 Oct 2022 11:32:18 -0400 Subject: [PATCH] core: avoid reversing initialization order list --- fpga/lib/core.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fpga/lib/core.cpp b/fpga/lib/core.cpp index 689adaa1a..de93b0716 100644 --- a/fpga/lib/core.cpp +++ b/fpga/lib/core.cpp @@ -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); }