diff --git a/src/rose/rose_build_anchored.cpp b/src/rose/rose_build_anchored.cpp index 0c556dfe..675f8c68 100644 --- a/src/rose/rose_build_anchored.cpp +++ b/src/rose/rose_build_anchored.cpp @@ -271,16 +271,13 @@ public: typedef Holder_StateSet StateSet; typedef ue2::unordered_map StateMap; - explicit Automaton_Holder(const NGHolder &g_in) : g(g_in), bad(false) { + explicit Automaton_Holder(const NGHolder &g_in) : g(g_in) { for (auto v : vertices_range(g)) { vertexToIndex[v] = indexToVertex.size(); indexToVertex.push_back(v); } - if (indexToVertex.size() > ANCHORED_NFA_STATE_LIMIT) { - bad = true; - return; - } + assert(indexToVertex.size() <= ANCHORED_NFA_STATE_LIMIT); DEBUG_PRINTF("%zu states\n", indexToVertex.size()); init.wdelay = 0; @@ -400,7 +397,6 @@ public: array alpha; array unalpha; u16 alphasize; - bool bad; }; } // namespace @@ -670,13 +666,13 @@ int finalise_out(RoseBuildImpl &tbi, const NGHolder &h, static int addAutomaton(RoseBuildImpl &tbi, const NGHolder &h, ReportID *remap) { - Automaton_Holder autom(h); - - if (autom.bad) { + if (num_vertices(h) > ANCHORED_NFA_STATE_LIMIT) { DEBUG_PRINTF("autom bad!\n"); return ANCHORED_FAIL; } + Automaton_Holder autom(h); + unique_ptr out_dfa = ue2::make_unique(NFA_OUTFIX); if (!determinise(autom, out_dfa->states, MAX_DFA_STATES)) { return finalise_out(tbi, h, autom, move(out_dfa), remap); @@ -738,7 +734,6 @@ void buildSimpleDfas(const RoseBuildImpl &tbi, NGHolder h; populate_holder(simple.first, exit_ids, &h); Automaton_Holder autom(h); - assert(!autom.bad); unique_ptr rdfa = ue2::make_unique(NFA_OUTFIX); UNUSED int rv = determinise(autom, rdfa->states, MAX_DFA_STATES); assert(!rv);