ctdb-ipalloc: Tidy up create_merged_ip_list()
authorMartin Schwenke <martin@meltin.net>
Thu, 29 Oct 2015 09:46:54 +0000 (20:46 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 20 Nov 2015 00:36:32 +0000 (01:36 +0100)
Simplify with TALLOC_FREE() and fix some whitespace.

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

index f263fce296c7b0970a29829481802d6286bcf064..dea1bbdf0660514885786557f7440f998d9cddbc 100644 (file)
@@ -1478,13 +1478,10 @@ create_merged_ip_list(struct ctdb_context *ctdb)
        struct public_ip_list *ip_list;
        struct ctdb_public_ip_list_old *public_ips;
 
-       if (ctdb->ip_tree != NULL) {
-               talloc_free(ctdb->ip_tree);
-               ctdb->ip_tree = NULL;
-       }
+       TALLOC_FREE(ctdb->ip_tree);
        ctdb->ip_tree = trbt_create(ctdb, 0);
 
-       for (i=0;i<ctdb->num_nodes;i++) {
+       for (i=0; i < ctdb->num_nodes; i++) {
                public_ips = ctdb->ipalloc_state->known_public_ips[i];
 
                if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
@@ -1494,9 +1491,9 @@ create_merged_ip_list(struct ctdb_context *ctdb)
                /* there were no public ips for this node */
                if (public_ips == NULL) {
                        continue;
-               }               
+               }
 
-               for (j=0;j<public_ips->num;j++) {
+               for (j=0; j < public_ips->num; j++) {
                        struct public_ip_list *tmp_ip;
 
                        tmp_ip = talloc_zero(ctdb->ip_tree, struct public_ip_list);