util.c: qsort_s

* util.c (ruby_qsort): use qsort_s if available, for Microsoft
  Visual Studio 2005 (msvcr80.dll) and mingw.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-05-11 08:18:56 +00:00
parent d22cf0de18
commit be4b1c1e2c
4 changed files with 14 additions and 0 deletions

5
util.c
View file

@ -191,6 +191,11 @@ ruby_strtoul(const char *str, char **endptr, int base)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined HAVE_BSD_QSORT_R && defined HAVE_QSORT_S
# define qsort_r(base, nel, size, arg, cmp) qsort_s(base, nel, size, cmp, arg)
# define cmp_bsd_qsort cmp_ms_qsort
# define HAVE_BSD_QSORT_R 1
#endif
#if defined HAVE_BSD_QSORT_R
typedef int (cmpfunc_t)(const void*, const void*, void*);