diff options
author | Ondrej Filip <feela@network.cz> | 2011-03-27 23:27:37 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2011-03-27 23:27:37 +0200 |
commit | c454872f4e81e69a8e9950289ab810fcac3fc922 (patch) | |
tree | 46146fc1cdc6134f636f6a5d8adb2fe52b9b1aed /filter | |
parent | 4e712ec3b7cb4678607b2a48a2feaa0658333ab2 (diff) | |
download | bird-c454872f4e81e69a8e9950289ab810fcac3fc922.tar bird-c454872f4e81e69a8e9950289ab810fcac3fc922.zip |
Avoid using stack.
Diffstat (limited to 'filter')
-rw-r--r-- | filter/config.Y | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/filter/config.Y b/filter/config.Y index d1dd081..ebe6f49 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -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 |