From: Justin Viiret Date: Tue, 11 Oct 2016 22:49:09 +0000 (+1100) Subject: ng_restructuring: wire start to tops in idx order X-Git-Tag: v4.4.0^2~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e108cb841f585e0d88e5f3c58e1f50d16cdf42e9;p=thirdparty%2Fvectorscan.git ng_restructuring: wire start to tops in idx order --- diff --git a/src/nfagraph/ng_restructuring.cpp b/src/nfagraph/ng_restructuring.cpp index 46990330..3b30a689 100644 --- a/src/nfagraph/ng_restructuring.cpp +++ b/src/nfagraph/ng_restructuring.cpp @@ -52,7 +52,11 @@ namespace ue2 { static void wireStartToTops(NGHolder &g, const flat_set &tops, vector &tempEdges) { - for (NFAVertex v : tops) { + // Construct edges in vertex index order, for determinism. + vector ordered_tops(begin(tops), end(tops)); + sort(begin(ordered_tops), end(ordered_tops), make_index_ordering(g)); + + for (NFAVertex v : ordered_tops) { assert(!isLeafNode(v, g)); const NFAEdge &e = add_edge(g.start, v, g).first;