]> granicus.if.org Git - re2c/commitdiff
- WS/CS (some compilers don't even like this)
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 6 May 2006 23:53:29 +0000 (23:53 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 6 May 2006 23:53:29 +0000 (23:53 +0000)
code.cc

diff --git a/code.cc b/code.cc
index 371acbbe22d76722123956fe0e418a58d8926a4a..fee804b6c5de23ac721d15c4104406981a604b2a 100644 (file)
--- a/code.cc
+++ b/code.cc
@@ -1095,7 +1095,7 @@ void SCC::traverse(State *x)
        }
 }
 
-static bool state_is_in_non_trivial_SCC( const State* s )
+static bool state_is_in_non_trivial_SCC(const State* s)
 {
        
        // does not link to self
@@ -1113,7 +1113,7 @@ static bool state_is_in_non_trivial_SCC( const State* s )
        {
                const State* t = s->go.span[i].to;
        
-               if (t &&  t->link == s)
+               if (t && t->link == s)
                {
                        return true;
                }
@@ -1161,25 +1161,26 @@ uint maxDist(State *s)
 
 void calcDepth(State *head)
 {
+       State* s;
+
        // mark non-key states by s->link = NULL ;
-       for (State* s = head; s; s = s->next)
+       for (s = head; s; s = s->next)
        {
-               if ( (s!=head) &&  !state_is_in_non_trivial_SCC(s) )
+               if (s != head && !state_is_in_non_trivial_SCC(s))
                {
-                       s->link=NULL;
-               } else {
-                               // key state, leave alone
+                       s->link = NULL;
                }
+               //else: key state, leave alone
        }
        
-       for (State* s = head; s; s = s->next)
+       for (s = head; s; s = s->next)
        {
                s->depth = cInfinity;
        }
 
        // calculate max number of transitions before guarantied to reach
        // a key state.
-       for (State* s = head; s; s = s->next)
+       for (s = head; s; s = s->next)
        {
                maxDist(s);
        }