0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Several simplifications of the fib iterators.

This commit is contained in:
Martin Mares 2000-05-08 19:11:49 +00:00
parent 0bcba21e89
commit 8abbde02d4
2 changed files with 21 additions and 20 deletions

View File

@ -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)

View File

@ -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))