From: Katerina Kubecova Date: Thu, 2 Nov 2023 13:28:50 +0000 (+0100) Subject: FIB walk macros now allow continue from the loop X-Git-Tag: v3.0.0~351^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e9725e8256ba8283ffd8e28d15b027230c738ec;p=thirdparty%2Fbird.git FIB walk macros now allow continue from the loop --- diff --git a/lib/fib.h b/lib/fib.h index bec2a8d4b..1fbcec5f9 100644 --- a/lib/fib.h +++ b/lib/fib.h @@ -94,17 +94,16 @@ void fit_copy(struct fib *f, struct fib_iterator *dst, struct fib_iterator *src) uint count_ = (fib)->hash_size; \ uint hpos_ = (it)->hash; \ type *z; \ - for(;;) { \ - if (!fn_) \ + for(;;fn_ = fn_->next) { \ + while (!fn_ && ++hpos_ < count_) \ { \ - if (++hpos_ >= count_) \ - break; \ fn_ = (fib)->hash_table[hpos_]; \ - continue; \ } \ + if (hpos_ >= count_) \ + break; \ z = fib_node_to_user(fib, fn_); -#define FIB_ITERATE_END fn_ = fn_->next; } } while(0) +#define FIB_ITERATE_END } } while(0) #define FIB_ITERATE_PUT(it) fit_put(it, fn_)