s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code
[ira/wip.git] / lib / util / tsort.h
index 236b3699123bb6f95788878b465c4db3c2d80f2b..811d6cd2f77c734c8c9c28acd9d661e4d0cd9978 100644 (file)
   a wrapper around qsort() that ensures the comparison function is
   type safe.
  */
+#ifndef TYPESAFE_QSORT
 #define TYPESAFE_QSORT(base, numel, comparison) \
 do { \
        if (numel > 1) { \
-               qsort(base, numel, sizeof((base)[0]), QSORT_CAST comparison); \
+               qsort(base, numel, sizeof((base)[0]), (int (*)(const void *, const void *))comparison); \
                assert(comparison(&((base)[0]), &((base)[1])) <= 0); \
        } \
 } while (0)
+#endif
 
 #endif