summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-14 10:37:20 +1100
committerAndrew Tridgell <tridge@samba.org>2010-02-14 18:44:20 +1100
commit282cc79454f7b708085a04d04e98d11ffec8b293 (patch)
treed91205910306d6a7f39dc3a10e283405a701bee2 /source4/lib/ldb/tools
parent0c39fbc94ed6ad3aa18a6b3c15743707236f35c3 (diff)
downloadsamba-282cc79454f7b708085a04d04e98d11ffec8b293.tar.gz
samba-282cc79454f7b708085a04d04e98d11ffec8b293.tar.bz2
samba-282cc79454f7b708085a04d04e98d11ffec8b293.zip
s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code
Diffstat (limited to 'source4/lib/ldb/tools')
-rw-r--r--source4/lib/ldb/tools/ldbdel.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index 6de15ee042..1b8adf714c 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -34,13 +34,11 @@
#include "ldb.h"
#include "tools/cmdline.h"
#include "ldbutil.h"
+#include "replace.h"
-static int dn_cmp(const void *p1, const void *p2)
+static int dn_cmp(struct ldb_message **msg1, struct ldb_message **msg2)
{
- const struct ldb_message *msg1, *msg2;
- msg1 = *(const struct ldb_message * const *)p1;
- msg2 = *(const struct ldb_message * const *)p2;
- return ldb_dn_compare(msg1->dn, msg2->dn);
+ return ldb_dn_compare((*msg1)->dn, (*msg2)->dn);
}
static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struct ldb_control **req_ctrls)
@@ -53,7 +51,7 @@ static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struc
if (ret != LDB_SUCCESS) return -1;
/* sort the DNs, deepest first */
- qsort(res->msgs, res->count, sizeof(res->msgs[0]), dn_cmp);
+ TYPESAFE_QSORT(res->msgs, res->count, dn_cmp);
for (i = 0; i < res->count; i++) {
if (ldb_delete_ctrl(ldb, res->msgs[i]->dn,req_ctrls) == 0) {