ctdb-ipalloc: Fix warning about unused value assigned to srcimbl
authorMartin Schwenke <martin@meltin.net>
Thu, 30 May 2019 05:41:42 +0000 (15:41 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 5 Jun 2019 10:25:50 +0000 (10:25 +0000)
To make this much clearer, move the declaration into the scope where
it is used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ipalloc_lcp2.c

index 6993e7a70147b31b5f8c9d526391c4a8a3c6b92d..bc2936bb76ee72fb2d09e42462a2eee241858684 100644 (file)
@@ -309,13 +309,12 @@ static bool lcp2_failback_candidate(struct ipalloc_state *ipalloc_state,
                                    bool *rebalance_candidates)
 {
        unsigned int dstnode, mindstnode, numnodes;
-       uint32_t srcimbl, srcdsum, dstimbl, dstdsum;
+       uint32_t srcdsum, dstimbl, dstdsum;
        uint32_t minsrcimbl, mindstimbl;
        struct public_ip_list *minip;
        struct public_ip_list *t;
 
        /* Find an IP and destination node that best reduces imbalance. */
-       srcimbl = 0;
        minip = NULL;
        minsrcimbl = 0;
        mindstnode = CTDB_UNKNOWN_PNN;
@@ -328,6 +327,8 @@ static bool lcp2_failback_candidate(struct ipalloc_state *ipalloc_state,
                           srcnode, lcp2_imbalances[srcnode]));
 
        for (t = ipalloc_state->all_ips; t != NULL; t = t->next) {
+               uint32_t srcimbl;
+
                /* Only consider addresses on srcnode. */
                if (t->pnn != srcnode) {
                        continue;