]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-server: Add some local variables
authorMartin Schwenke <mschwenke@ddn.com>
Sun, 29 Sep 2024 04:06:51 +0000 (14:06 +1000)
committerAnoop C S <anoopcs@samba.org>
Mon, 7 Oct 2024 15:58:38 +0000 (15:58 +0000)
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 <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
ctdb/server/ctdb_recoverd.c

index 09d5df3e9cbbdb9303e276a96786a03e7cc12d2d..f31ff43ee0b47f3d966bef42fbf56d874007e1f9 100644 (file)
@@ -2356,18 +2356,19 @@ static int verify_local_ip_allocation(struct ctdb_recoverd *rec)
        }
 
        for (j=0; j<ips->num; 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;
                        }
                }