From 282cc79454f7b708085a04d04e98d11ffec8b293 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 14 Feb 2010 10:37:20 +1100 Subject: s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code --- source4/lib/ldb/include/ldb.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source4/lib/ldb/include') diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 26a196f311..fc5d47ac32 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -2002,6 +2002,17 @@ do { \ } \ } while (0) +/* allow ldb to also call TYPESAFE_QSORT() */ +#ifndef TYPESAFE_QSORT +#define TYPESAFE_QSORT(base, numel, comparison) \ +do { \ + if (numel > 1) { \ + qsort(base, numel, sizeof((base)[0]), (int (*)(const void *, const void *))comparison); \ + comparison(&((base)[0]), &((base)[1])); \ + } \ +} while (0) +#endif + /** -- cgit