From 559dbc2ea19f8618e8c8284d28e9f21d939db1bd Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 24 Mar 2023 14:21:43 -0400 Subject: [PATCH] zebra: Cleanup indentation in function Indentation was deep and hard to understand in zebra_gr_delete_stale_route Signed-off-by: Donald Sharp --- zebra/zebra_gr.c | 86 ++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/zebra/zebra_gr.c b/zebra/zebra_gr.c index 3a2351348e..daebfa8c57 100644 --- a/zebra/zebra_gr.c +++ b/zebra/zebra_gr.c @@ -556,55 +556,55 @@ static int32_t zebra_gr_delete_stale_route(struct client_gr_info *info, for (afi = curr_afi; afi < AFI_MAX; afi++) { table = zvrf->table[afi][SAFI_UNICAST]; - if (table) { - /* - * If the current prefix is NULL then get the first - * route entry in the table - */ - if (info->current_prefix == NULL) { - rn = route_top(table); - if (rn == NULL) + if (!table) + continue; + + /* + * If the current prefix is NULL then get the first + * route entry in the table + */ + if (info->current_prefix == NULL) { + rn = route_top(table); + if (rn == NULL) + continue; + curr = rn; + } else + /* Get the next route entry */ + curr = route_table_get_next(table, + info->current_prefix); + + for (rn = curr; rn; rn = srcdest_route_next(rn)) { + RNODE_FOREACH_RE_SAFE (rn, re, next) { + if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) continue; - curr = rn; - } else - /* Get the next route entry */ - curr = route_table_get_next( - table, info->current_prefix); + /* If the route refresh is received + * after restart then do not delete + * the route + */ + if (re->type == proto && + re->instance == instance) { + zebra_gr_process_route_entry(s_client, + rn, re); + n++; + } - for (rn = curr; rn; rn = srcdest_route_next(rn)) { - RNODE_FOREACH_RE_SAFE (rn, re, next) { - if (CHECK_FLAG(re->status, - ROUTE_ENTRY_REMOVED)) - continue; - /* If the route refresh is received - * after restart then do not delete - * the route - */ - if (re->type == proto - && re->instance == instance) { - zebra_gr_process_route_entry( - s_client, rn, re); - n++; - } - - /* If the max route count is reached - * then timer thread will be restarted - * Store the current prefix and afi - */ - if ((n >= ZEBRA_MAX_STALE_ROUTE_COUNT) - && (info->do_delete == false)) { - info->current_afi = afi; - info->current_prefix = XCALLOC( - MTYPE_ZEBRA_GR, + /* If the max route count is reached + * then timer thread will be restarted + * Store the current prefix and afi + */ + if ((n >= ZEBRA_MAX_STALE_ROUTE_COUNT) && + (info->do_delete == false)) { + info->current_afi = afi; + info->current_prefix = + XCALLOC(MTYPE_ZEBRA_GR, sizeof(struct prefix)); - prefix_copy( - info->current_prefix, - &rn->p); - return n; - } + prefix_copy(info->current_prefix, + &rn->p); + return n; } } } + /* * Reset the current prefix to indicate processing completion * of the current AFI