add QSORT_S
[gitweb.git] / git-compat-util.h
index f706744e6a9e8acdea5241518d7b990fb3121296..f46d40e4a475c9bd35ff02373101e8431e722b7d 100644 (file)
@@ -994,6 +994,11 @@ int git_qsort_s(void *base, size_t nmemb, size_t size,
 #define qsort_s git_qsort_s
 #endif
 
+#define QSORT_S(base, n, compar, ctx) do {                     \
+       if (qsort_s((base), (n), sizeof(*(base)), compar, ctx)) \
+               die("BUG: qsort_s() failed");                   \
+} while (0)
+
 #ifndef REG_STARTEND
 #error "Git requires REG_STARTEND support. Compile with NO_REGEX=NeedsStartEnd"
 #endif