s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code
[ira/wip.git] / source4 / lib / ldb / include / ldb.h
index 26a196f311321f43237013af6a1eb334659187c0..fc5d47ac32187fbbca21ac23f0a5600d5316c759 100644 (file)
@@ -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
+
 
 
 /**