#include "../libcli/drsuapi/drsuapi.h"
#include "libcli/security/security.h"
#include "lib/util/binsearch.h"
+#include "lib/util/tsort.h"
/*
build a DsReplicaObjectIdentifier from a ldb msg
/*
sort the objects we send by tree order
*/
-static int site_res_cmp_parent_order(const struct ldb_message **m1, const struct ldb_message **m2)
+static int site_res_cmp_parent_order(struct ldb_message **m1, struct ldb_message **m2)
{
return ldb_dn_compare((*m2)->dn, (*m1)->dn);
}
/*
sort the objects we send first by uSNChanged
*/
-static int site_res_cmp_usn_order(const struct ldb_message **m1, const struct ldb_message **m2)
+static int site_res_cmp_usn_order(struct ldb_message **m1, struct ldb_message **m2)
{
unsigned usnchanged1, usnchanged2;
unsigned cn1, cn2;
}
if (req8->replica_flags & DRSUAPI_DRS_GET_ANC) {
- qsort(getnc_state->site_res->msgs,
- getnc_state->site_res->count,
- sizeof(getnc_state->site_res->msgs[0]),
- (comparison_fn_t)site_res_cmp_parent_order);
+ TYPESAFE_QSORT(getnc_state->site_res->msgs,
+ getnc_state->site_res->count,
+ site_res_cmp_parent_order);
} else {
- qsort(getnc_state->site_res->msgs,
- getnc_state->site_res->count,
- sizeof(getnc_state->site_res->msgs[0]),
- (comparison_fn_t)site_res_cmp_usn_order);
+ TYPESAFE_QSORT(getnc_state->site_res->msgs,
+ getnc_state->site_res->count,
+ site_res_cmp_usn_order);
}
getnc_state->uptodateness_vector = talloc_steal(getnc_state, req8->uptodateness_vector);
if (getnc_state->uptodateness_vector) {
/* make sure its sorted */
- qsort(getnc_state->uptodateness_vector->cursors,
- getnc_state->uptodateness_vector->count,
- sizeof(getnc_state->uptodateness_vector->cursors[0]),
- (comparison_fn_t)drsuapi_DsReplicaCursor_compare);
+ TYPESAFE_QSORT(getnc_state->uptodateness_vector->cursors,
+ getnc_state->uptodateness_vector->count,
+ drsuapi_DsReplicaCursor_compare);
}
}
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "librpc/gen_ndr/ndr_lsa.h"
#include "../lib/crypto/crypto.h"
+#include "lib/util/tsort.h"
/*
this type allows us to distinguish handle types
}
/* sort the results by name */
- qsort(entries, count, sizeof(*entries),
- (comparison_fn_t)compare_DomainInfo);
+ TYPESAFE_QSORT(entries, count, compare_DomainInfo);
if (*r->in.resume_handle >= count) {
*r->out.resume_handle = -1;
}
/* sort the results by name */
- qsort(entries, count, sizeof(*entries),
- (comparison_fn_t)compare_TrustDomainInfoInfoEx);
+ TYPESAFE_QSORT(entries, count, compare_TrustDomainInfoInfoEx);
if (*r->in.resume_handle >= count) {
*r->out.resume_handle = -1;
#include "rpc_server/samr/proto.h"
#include "../lib/util/util_ldb.h"
#include "param/param.h"
+#include "lib/util/tsort.h"
/* these query macros make samr_Query[User|Group|Alias]Info a bit easier to read */
}
/* sort the results by rid */
- qsort(entries, count, sizeof(struct samr_SamEntry),
- (comparison_fn_t)compare_SamEntry);
+ TYPESAFE_QSORT(entries, count, compare_SamEntry);
/* find the first entry to return */
for (first=0;
}
/* sort the results by rid */
- qsort(entries, num_filtered_entries, sizeof(struct samr_SamEntry),
- (comparison_fn_t)compare_SamEntry);
+ TYPESAFE_QSORT(entries, num_filtered_entries, compare_SamEntry);
/* find the first entry to return */
for (first=0;
}
/* sort the results by rid */
- qsort(entries, count, sizeof(struct samr_SamEntry),
- (comparison_fn_t)compare_SamEntry);
+ TYPESAFE_QSORT(entries, count, compare_SamEntry);
/* find the first entry to return */
for (first=0;