ctdb-tests: Don't bother setting all_ips
authorMartin Schwenke <martin@meltin.net>
Tue, 21 Jun 2016 04:29:25 +0000 (14:29 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 4 Jul 2016 13:42:23 +0000 (15:42 +0200)
It isn't used outside this function.  Instead, update k directly.

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

index c832834907cc668edf62224b1f232b0058edfb37..3bf4d14dabd580ecf8e1d944b753a1bb8df13bfb 100644 (file)
@@ -66,11 +66,9 @@ read_ctdb_public_ip_info(TALLOC_CTX *ctx  ,
        char line[1024];
        ctdb_sock_addr addr;
        char *t, *tok;
-       struct public_ip_list * ta;
-       int pnn, numips, n, i;
+       int pnn, numips, n;
        struct ctdb_public_ip_list * k;
 
-       struct public_ip_list *last = NULL;
        enum ctdb_runstate *runstate;
 
        runstate = get_runstate(ctx, numnodes);
@@ -123,19 +121,7 @@ read_ctdb_public_ip_info(TALLOC_CTX *ctx  ,
                        pnn = (int) strtol(tok, (char **) NULL, 10);
                }
 
-               /* Add address + pnn to all_ips */
-               if (last == NULL) {
-                       last = talloc(ctx, struct public_ip_list);
-               } else {
-                       last->next = talloc(ctx, struct public_ip_list);
-                       last = last->next;
-               }
-               last->next = NULL;
-               last->pnn = pnn;
-               memcpy(&(last->addr), &addr, sizeof(addr));
-               if (*all_ips == NULL) {
-                       *all_ips = last;
-               }
+               add_ip(k, k, &addr, pnn);
 
                tok = strtok(NULL, " \t#");
                if (tok == NULL) {
@@ -152,10 +138,6 @@ read_ctdb_public_ip_info(TALLOC_CTX *ctx  ,
 
        }
 
-       for (ta = *all_ips, i=0; ta != NULL && i < numips ; ta = ta->next, i++) {
-               add_ip(k, k, &ta->addr, ta->pnn);
-       }
-
        /* Assign it to any nodes that don't have a list assigned */
        for (n = 0; n < numnodes; n++) {
                if ((*known)[n].num == 0) {