Author: metze Date: 2007-01-12 17:19:48 +0000 (Fri, 12 Jan 2007) New Revision: 20713
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20713 Log: sort the cursors in replUpToDateVector by source_dsa_invocation_id, w2k3 seems to do the same. It's later useful, when we would have a large array be could use a binary search metze Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c Changeset: Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c =================================================================== --- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c 2007-01-12 17:17:02 UTC (rev 20712) +++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c 2007-01-12 17:19:48 UTC (rev 20713) @@ -641,6 +641,12 @@ #endif } +static int replmd_drsuapi_DsReplicaCursor2_compare(const struct drsuapi_DsReplicaCursor2 *c1, + const struct drsuapi_DsReplicaCursor2 *c2) +{ + return GUID_compare(&c1->source_dsa_invocation_id, &c2->source_dsa_invocation_id); +} + static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *ar) { NTSTATUS nt_status; @@ -823,6 +829,13 @@ nuv.ctr.ctr2.count = ni; /* + * sort the cursors + */ + qsort(nuv.ctr.ctr2.cursors, nuv.ctr.ctr2.count, + sizeof(struct drsuapi_DsReplicaCursor2), + (comparison_fn_t)replmd_drsuapi_DsReplicaCursor2_compare); + + /* * create the change ldb_message */ msg = ldb_msg_new(ar->sub.mem_ctx);