@@ -611,7 +611,7 @@ size_t git__unescape(char *str)
611
611
return (pos - str );
612
612
}
613
613
614
- #if defined(GIT_WIN32 ) || defined(BSD )
614
+ #if defined(HAVE_QSORT_S ) || ( defined(HAVE_QSORT_R ) && defined( BSD ) )
615
615
typedef struct {
616
616
git__sort_r_cmp cmp ;
617
617
void * payload ;
@@ -628,21 +628,16 @@ static int GIT_STDLIB_CALL git__qsort_r_glue_cmp(
628
628
void git__qsort_r (
629
629
void * els , size_t nel , size_t elsize , git__sort_r_cmp cmp , void * payload )
630
630
{
631
- #if defined(__MINGW32__ ) || defined(AMIGA ) || \
632
- defined(__OpenBSD__ ) || defined(__NetBSD__ ) || \
633
- defined(__gnu_hurd__ ) || defined(__ANDROID_API__ ) || \
634
- defined(__sun ) || defined(__CYGWIN__ ) || \
635
- (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8 ) || \
636
- (defined(_MSC_VER ) && _MSC_VER < 1500 )
637
- git__insertsort_r (els , nel , elsize , NULL , cmp , payload );
638
- #elif defined(GIT_WIN32 )
639
- git__qsort_r_glue glue = { cmp , payload };
640
- qsort_s (els , nel , elsize , git__qsort_r_glue_cmp , & glue );
641
- #elif defined(BSD )
631
+ #if defined(HAVE_QSORT_R ) && defined(BSD )
642
632
git__qsort_r_glue glue = { cmp , payload };
643
633
qsort_r (els , nel , elsize , & glue , git__qsort_r_glue_cmp );
644
- #else
634
+ #elif defined( HAVE_QSORT_R ) && defined( __GLIBC__ )
645
635
qsort_r (els , nel , elsize , cmp , payload );
636
+ #elif defined(HAVE_QSORT_S )
637
+ git__qsort_r_glue glue = { cmp , payload };
638
+ qsort_s (els , nel , elsize , git__qsort_r_glue_cmp , & glue );
639
+ #else
640
+ git__insertsort_r (els , nel , elsize , NULL , cmp , payload );
646
641
#endif
647
642
}
648
643
0 commit comments