getnchanges.c: Avoid unnecessary continue
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 22 Aug 2017 05:32:32 +0000 (17:32 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Fri, 15 Sep 2017 04:18:13 +0000 (06:18 +0200)
There's not really much after the continue that we're skipping now. We
can just flip the logic and avoid the continue.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/rpc_server/drsuapi/getncchanges.c

index 0cd2b08c81e933bb60afa9be4f6e31224f1f2955..94b7d1d5294c3838d16df32b329dc0b2c9017c0a 100644 (file)
@@ -3044,24 +3044,21 @@ allowed:
                                        getnc_state->max_usn,
                                        &r->out.ctr->ctr6.new_highwatermark);
 
-               if (new_objs == NULL) {
-                       DEBUG(8,(__location__ ": getncchanges skipping send of object %s\n",
-                                ldb_dn_get_linearized(msg->dn)));
-                       /* nothing to send */
-                       TALLOC_FREE(tmp_ctx);
-                       continue;
-               }
+               if (new_objs != NULL) {
 
-               /*
-                * Add the object (and, if GET_ANC, any parents it may
-                * have) into the current chunk of replication data
-                */
-               getncchanges_add_objs_to_resp(&repl_chunk, new_objs);
+                       /*
+                        * Add the object (and, if GET_ANC, any parents it may
+                        * have) into the current chunk of replication data
+                        */
+                       getncchanges_add_objs_to_resp(&repl_chunk, new_objs);
 
-               DEBUG(8,(__location__ ": replicating object %s\n", ldb_dn_get_linearized(msg->dn)));
+                       talloc_free(getnc_state->last_dn);
+                       getnc_state->last_dn = talloc_move(getnc_state, &msg->dn);
+               }
 
-               talloc_free(getnc_state->last_dn);
-               getnc_state->last_dn = talloc_move(getnc_state, &msg->dn);
+               DEBUG(8,(__location__ ": %s object %s\n",
+                        new_objs ? "replicating" : "skipping send of",
+                        ldb_dn_get_linearized(msg->dn)));
 
                TALLOC_FREE(tmp_ctx);
        }