From 4d20babddf169eca35ebde912bdd34920c4cec80 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 21 Jun 2016 14:29:25 +1000 Subject: [PATCH] ctdb-tests: Don't bother setting all_ips It isn't used outside this function. Instead, update k directly. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/src/ctdb_takeover_tests.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/ctdb/tests/src/ctdb_takeover_tests.c b/ctdb/tests/src/ctdb_takeover_tests.c index c832834907c..3bf4d14dabd 100644 --- a/ctdb/tests/src/ctdb_takeover_tests.c +++ b/ctdb/tests/src/ctdb_takeover_tests.c @@ -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) {