From: Martin Schwenke Date: Sun, 29 Sep 2024 04:06:51 +0000 (+1000) Subject: ctdb-server: Add some local variables X-Git-Tag: tdb-1.4.13~1000 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a15167aafe83127efd33d5e5875ffb87746e986a;p=thirdparty%2Fsamba.git 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 --- 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; } }