diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-02-18 01:02:55 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-02-23 13:08:36 +0100 |
commit | 55cd0f612a046137f0be936e7856921ada4546ca (patch) | |
tree | 33ebc2df612fe462d3f422834fe6c99c409320f1 /zebra/zebra_ns.c | |
parent | zebra: On shutdown don't count removals (diff) | |
download | frr-55cd0f612a046137f0be936e7856921ada4546ca.tar.xz frr-55cd0f612a046137f0be936e7856921ada4546ca.zip |
*: Make assignment from RB_ROOT in while loop work better
Fix up the assignment of the variable = RB_ROOT inside of
while loop patter we were using.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_ns.c')
-rw-r--r-- | zebra/zebra_ns.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index ac724a329..e8bdadee5 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -77,13 +77,13 @@ int zebra_ns_enable(ns_id_t ns_id, void **info) struct route_table *zebra_ns_find_table(struct zebra_ns *zns, uint32_t tableid, afi_t afi) { - struct zebra_ns_tables finder; - struct zebra_ns_tables *znst; + struct zebra_ns_table finder; + struct zebra_ns_table *znst; memset(&finder, 0, sizeof(finder)); finder.afi = afi; finder.tableid = tableid; - znst = RB_FIND(zebra_ns_tables_head, &zns->ns_tables, &finder); + znst = RB_FIND(zebra_ns_table_head, &zns->ns_tables, &finder); if (znst) return znst->table; @@ -141,8 +141,9 @@ int zebra_ns_disable(ns_id_t ns_id, void **info) struct zebra_ns_table *znst; struct zebra_ns *zns = (struct zebra_ns *)(*info); - while ((znst = RB_ROOT(zebra_ns_table_head, &zns->ns_tables)) - != NULL) { + while (!RB_EMPTY(zebra_ns_table_head, &zns->ns_tables)) { + znst = RB_ROOT(zebra_ns_table_head, &zns->ns_tables); + RB_REMOVE(zebra_ns_table_head, &zns->ns_tables, znst); znst = zebra_ns_free_table(znst); } |