diff options
author | Martin Mares <mj@ucw.cz> | 2000-05-08 21:11:49 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-05-08 21:11:49 +0200 |
commit | 8abbde02d46830168b79a1df6c18c3ffaea49b9e (patch) | |
tree | e91f6e6a914c523e91a800bd3ed3aa41096579cd /nest | |
parent | 0bcba21e893efb9853a68b04674e4bde9da5a1b8 (diff) | |
download | bird-8abbde02d46830168b79a1df6c18c3ffaea49b9e.tar bird-8abbde02d46830168b79a1df6c18c3ffaea49b9e.zip |
Several simplifications of the fib iterators.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/route.h | 13 | ||||
-rw-r--r-- | nest/rt-fib.c | 28 |
2 files changed, 21 insertions, 20 deletions
diff --git a/nest/route.h b/nest/route.h index 66a32ed..d15ffae 100644 --- a/nest/route.h +++ b/nest/route.h @@ -86,12 +86,13 @@ void fit_put(struct fib_iterator *, struct fib_node *); unsigned int count = (fib)->hash_size; \ unsigned int hpos = (it)->hash; \ for(;;) { \ - fis_again: if (!z) { \ - if (++hpos >= count) \ - break; \ - z = (fib)->hash_table[hpos]; \ - goto fis_again; \ - } + if (!z) \ + { \ + if (++hpos >= count) \ + break; \ + z = (fib)->hash_table[hpos]; \ + continue; \ + } #define FIB_ITERATE_END(z) z = z->next; } } while(0) diff --git a/nest/rt-fib.c b/nest/rt-fib.c index fb1be6e..22ba2ff 100644 --- a/nest/rt-fib.c +++ b/nest/rt-fib.c @@ -163,20 +163,20 @@ fib_merge_readers(struct fib_iterator *i, struct fib_node *to) /* Fast path */ to->readers = i; i->prev = (struct fib_iterator *) to; - fixup: - while (i && i->node) - { - i->node = NULL; - i = i->next; - } - return; } - /* Really merging */ - while (j->next) - j = j->next; - j->next = i; - i->prev = j; - goto fixup; + else + { + /* Really merging */ + while (j->next) + j = j->next; + j->next = i; + i->prev = j; + } + while (i && i->node) + { + i->node = NULL; + i = i->next; + } } else /* No more nodes */ while (i) @@ -260,7 +260,7 @@ fit_get(struct fib *f, struct fib_iterator *i) if (!i->prev) { /* We are at the end */ - i->hash = f->hash_size; + i->hash = ~0 - 1; return NULL; } if (!(n = i->node)) |