From 7d67b9ff28d09de58c632f80ef7d330e45e698f6 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Wed, 11 Oct 2023 00:15:32 +0300 Subject: build: add -Wimplicit-fallthrough Also: - replace all /* fallthrough */ comments with portable fallthrough; pseudo keyword to accomodate both gcc and clang - add missing break; statements as required by older versions of gcc - cleanup some code to remove unnecessary fallthrough Signed-off-by: Igor Ryzhov --- ldpd/neighbor.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'ldpd/neighbor.c') diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index 5209c55bb..d40728b04 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -505,21 +505,12 @@ nbr_start_idtimer(struct nbr *nbr) { int secs; - secs = INIT_DELAY_TMR; - switch(nbr->idtimer_cnt) { - default: + if (nbr->idtimer_cnt > 2) { /* do not further increase the counter */ secs = MAX_DELAY_TMR; - break; - case 2: - secs *= 2; - /* FALLTHROUGH */ - case 1: - secs *= 2; - /* FALLTHROUGH */ - case 0: + } else { + secs = INIT_DELAY_TMR * (1 << nbr->idtimer_cnt); nbr->idtimer_cnt++; - break; } EVENT_OFF(nbr->initdelay_timer); -- cgit v1.2.3