Merge branch 'jk/clone-copy-alternates-fix'
[gitweb.git] / git-compat-util.h
index 0ce2cdfb98d54e35881a94e9037e7380ec5b821c..43718dabae88062b39d65f2d6c1f5e35a6eb4800 100644 (file)
@@ -985,6 +985,14 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 #define qsort git_qsort
 #endif
 
+#define QSORT(base, n, compar) sane_qsort((base), (n), sizeof(*(base)), compar)
+static inline void sane_qsort(void *base, size_t nmemb, size_t size,
+                             int(*compar)(const void *, const void *))
+{
+       if (nmemb > 1)
+               qsort(base, nmemb, size, compar);
+}
+
 #ifndef REG_STARTEND
 #error "Git requires REG_STARTEND support. Compile with NO_REGEX=NeedsStartEnd"
 #endif