From c57c6f34abb0abacb59ec11c8df4b3e5765de280 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Fri, 28 Aug 2015 22:33:51 +0100 Subject: [PATCH] Another minor simplification of control flow. --- re2c/src/ir/dfa/dfa.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/re2c/src/ir/dfa/dfa.cc b/re2c/src/ir/dfa/dfa.cc index 2b2bd41e..4520bd96 100644 --- a/re2c/src/ir/dfa/dfa.cc +++ b/re2c/src/ir/dfa/dfa.cc @@ -183,20 +183,22 @@ State *DFA::findState(Ins **kernel, ptrdiff_t kCount) } if (marked) { - goto unmarkAll; + break; } } } - s = new State; - addState(tail, s); - s->kCount = kCount; - s->kernel = new Ins * [kCount + 1]; - memcpy(s->kernel, kernel, (kCount + 1)*sizeof(Ins*)); - s->link = toDo; - toDo = s; + if (!s) + { + s = new State; + addState(tail, s); + s->kCount = kCount; + s->kernel = new Ins * [kCount + 1]; + memcpy(s->kernel, kernel, (kCount + 1)*sizeof(Ins*)); + s->link = toDo; + toDo = s; + } -unmarkAll: for (Ins ** iP = kernel, * i; (i = *iP); ++iP) { unmark(i); -- 2.40.0