From: Donald Sharp Date: Wed, 23 Sep 2020 00:47:33 +0000 (-0400) Subject: zebra: Move debug information gathering to inside guard X-Git-Tag: frr-7.5~11^2~36 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c17f665a4077300ce6dffa83d9e309e084b587d2;p=matthieu%2Ffrr.git zebra: Move debug information gathering to inside guard Let's not make the entire `depend_finds` function pay for the data gathering needed for the debug. There are numerous other places in the code that check the NEXTHOP_FLAG_RECURSIVE and do the same output. Signed-off-by: Donald Sharp --- diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index b8faaa43fd..aabbd875ec 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1366,7 +1366,6 @@ static struct nhg_hash_entry *depends_find_singleton(const struct nexthop *nh, static struct nhg_hash_entry *depends_find(const struct nexthop *nh, afi_t afi) { struct nhg_hash_entry *nhe = NULL; - char rbuf[10]; if (!nh) goto done; @@ -1374,18 +1373,18 @@ static struct nhg_hash_entry *depends_find(const struct nexthop *nh, afi_t afi) /* We are separating these functions out to increase handling speed * in the non-recursive case (by not alloc/freeing) */ - if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_RECURSIVE)) { + if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_RECURSIVE)) nhe = depends_find_recursive(nh, afi); - strlcpy(rbuf, "(R)", sizeof(rbuf)); - } else { + else nhe = depends_find_singleton(nh, afi); - rbuf[0] = '\0'; - } - if (IS_ZEBRA_DEBUG_NHG_DETAIL) - zlog_debug("%s: nh %pNHv %s => %p (%u)", - __func__, nh, rbuf, + + if (IS_ZEBRA_DEBUG_NHG_DETAIL) { + zlog_debug("%s: nh %pNHv %s => %p (%u)", __func__, nh, + CHECK_FLAG(nh->flags, NEXTHOP_FLAG_RECURSIVE) ? "(R)" + : "", nhe, nhe ? nhe->id : 0); + } done: return nhe;