From a15167aafe83127efd33d5e5875ffb87746e986a Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Sun, 29 Sep 2024 14:06:51 +1000 Subject: [PATCH] ctdb-server: Add some local variables Improve readability by not repeating the complex expression now assigned to addr. ctdb_sys_have_ip() is called in both arms of the if/else, so call it once when declaring the new variable. Modernise debug macros while touching lines. Signed-off-by: Martin Schwenke Reviewed-by: John Mulligan Reviewed-by: Anoop C S --- ctdb/server/ctdb_recoverd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 09d5df3e9cb..f31ff43ee0b 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -2356,18 +2356,19 @@ static int verify_local_ip_allocation(struct ctdb_recoverd *rec) } for (j=0; jnum; j++) { + ctdb_sock_addr *addr = &ips->ips[j].addr; + bool have_ip = ctdb_sys_have_ip(addr); + if (ips->ips[j].pnn == rec->pnn) { - if (!ctdb_sys_have_ip(&ips->ips[j].addr)) { - DEBUG(DEBUG_ERR, - ("Assigned IP %s not on an interface\n", - ctdb_addr_to_str(&ips->ips[j].addr))); + if (!have_ip) { + D_ERR("Assigned IP %s not on an interface\n", + ctdb_addr_to_str(addr)); need_takeover_run = true; } } else { - if (ctdb_sys_have_ip(&ips->ips[j].addr)) { - DEBUG(DEBUG_ERR, - ("IP %s incorrectly on an interface\n", - ctdb_addr_to_str(&ips->ips[j].addr))); + if (have_ip) { + D_ERR("IP %s incorrectly on an interface\n", + ctdb_addr_to_str(addr)); need_takeover_run = true; } }