]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Small performance improvement for garbage collection
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 11 Sep 2017 15:12:03 +0000 (11:12 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 11 Sep 2017 15:12:03 +0000 (11:12 -0400)
There is no need to retrieve the zvrf *unless* we are doing
debugs.  So move the retrieval under the debug statement.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_rib.c

index c4c80b156b796c9c0188b5e027c6ade99feab422..9dc0630c8c8e64c70bbd4a4a7da8d48ef831d18b 100644 (file)
@@ -1118,7 +1118,6 @@ static int rib_can_delete_dest(rib_dest_t *dest)
 int rib_gc_dest(struct route_node *rn)
 {
        rib_dest_t *dest;
-       struct zebra_vrf *zvrf;
 
        dest = rib_dest_from_rnode(rn);
        if (!dest)
@@ -1127,9 +1126,12 @@ int rib_gc_dest(struct route_node *rn)
        if (!rib_can_delete_dest(dest))
                return 0;
 
-       zvrf = rib_dest_vrf(dest);
-       if (IS_ZEBRA_DEBUG_RIB)
+       if (IS_ZEBRA_DEBUG_RIB) {
+               struct zebra_vrf *zvrf;
+
+               zvrf = rib_dest_vrf(dest);
                rnode_debug(rn, zvrf_id(zvrf), "removing dest from table");
+       }
 
        dest->rnode = NULL;
        XFREE(MTYPE_RIB_DEST, dest);