From: Justin Viiret Date: Thu, 21 Jul 2016 02:57:12 +0000 (+1000) Subject: ng_violet: iterate in edge order X-Git-Tag: v4.3.0^2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63528f1cd2724b0e00a7e8e7e1b363f758bdace9;p=thirdparty%2Fvectorscan.git ng_violet: iterate in edge order --- diff --git a/src/nfagraph/ng_violet.cpp b/src/nfagraph/ng_violet.cpp index fe917c77..3c79dbc3 100644 --- a/src/nfagraph/ng_violet.cpp +++ b/src/nfagraph/ng_violet.cpp @@ -1622,7 +1622,8 @@ void removeRedundantLiteralsFromInfix(const NGHolder &h, RoseInGraph &ig, static void removeRedundantLiteralsFromInfixes(RoseInGraph &g, const CompileContext &cc) { - map > infixes; + vector seen_order; + map> infixes; for (const RoseInEdge &e : edges_range(g)) { RoseInVertex s = source(e, g); @@ -1637,11 +1638,16 @@ void removeRedundantLiteralsFromInfixes(RoseInGraph &g, } assert(!g[t].delay); - infixes[&*g[e].graph].push_back(e); + + NGHolder *h = g[e].graph.get(); + if (!contains(infixes, h)) { + seen_order.push_back(h); + } + infixes[h].push_back(e); } - for (const auto &info : infixes) { - removeRedundantLiteralsFromInfix(*info.first, g, info.second, cc); + for (NGHolder *h : seen_order) { + removeRedundantLiteralsFromInfix(*h, g, infixes[h], cc); } }