]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Avoid using stack.
authorOndrej Filip <feela@network.cz>
Sun, 27 Mar 2011 21:27:37 +0000 (23:27 +0200)
committerOndrej Filip <feela@network.cz>
Sun, 27 Mar 2011 21:27:37 +0000 (23:27 +0200)
filter/config.Y

index d1dd081e97f4ca39d58ceaf3f51a6e2f0cbb083d..ebe6f498eba0519d0e65cb26bd8cfec27c1de576 100644 (file)
@@ -27,15 +27,17 @@ static int make_pair(int i1, int i2)
 
 struct f_tree *f_generate_rev_wcard(int from, int to, int expr)
 {
-       struct f_tree * ret = NULL;
-       if(from <= to) {
+       struct f_tree *ret = NULL, *last = NULL;
+
+       while (from <= to) {
                ret = f_new_tree(); 
                ret->from.type = ret->to.type = T_PAIR;
                ret->from.val.i = ret->to.val.i = make_pair(from, expr); 
-               ret->left = f_generate_rev_wcard(from+1, to, expr);
+               ret->left = last;
+
+               from++; last = ret;
        }
        return ret;
-
 }
 
 CF_DECLS