]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Several simplifications of the fib iterators.
authorMartin Mares <mj@ucw.cz>
Mon, 8 May 2000 19:11:49 +0000 (19:11 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 8 May 2000 19:11:49 +0000 (19:11 +0000)
nest/route.h
nest/rt-fib.c

index 66a32ed98fb9f9a9025bddcee803c25136d818b8..d15ffae682a35c10712dc0cbafa1964765e2d5bd 100644 (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)
 
index fb1be6e2f6d73192cb07bd0c90bd2ab555d9e3ab..22ba2ff63d00c99fd7980e154ffa853489eedb9c 100644 (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))