From 79252ed0c0c26659a95729da0f2accaa0ddb458d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 4 Dec 2025 15:48:44 +0100 Subject: [PATCH] router: skip if branch in PIO clear functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We can skip the if branch that replaces the expired/duplicated ra_pio value in the router_clear_*_ra_pio() functions. Suggested-by: Paul Donald Link: https://github.com/openwrt/odhcpd/pull/336 Signed-off-by: Álvaro Fernández Rojas --- src/router.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/router.c b/src/router.c index 0e7a110..afb64ae 100644 --- a/src/router.c +++ b/src/router.c @@ -544,9 +544,7 @@ static void router_clear_duplicated_ra_pio(struct interface *iface) inet_ntop(AF_INET6, &pio_a->prefix, ipv6_str, sizeof(ipv6_str)), pio_a->length); - if (j + 1 < iface->pio_cnt) - iface->pios[j] = iface->pios[iface->pio_cnt - 1]; - + iface->pios[j] = iface->pios[iface->pio_cnt - 1]; iface->pio_cnt--; } else { j++; @@ -577,9 +575,7 @@ static void router_clear_expired_ra_pio(time_t now, inet_ntop(AF_INET6, &cur_pio->prefix, ipv6_str, sizeof(ipv6_str)), cur_pio->length); - if (i + 1 < iface->pio_cnt) - iface->pios[i] = iface->pios[iface->pio_cnt - 1]; - + iface->pios[i] = iface->pios[iface->pio_cnt - 1]; iface->pio_cnt--; } else { i++; -- 2.30.2