aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-11 08:18:56 +0000
committerKazuki Yamaguchi <k@rhe.jp>2016-05-13 13:32:48 +0900
commitde9695e3bf0048f17e1c9f3efe6bfb38d21ad3bc (patch)
tree5352fc82b67f50120c5272353eea60a327d60400
parent1b8f919af72d5a861f9748b6e81acbf7f6ec51b6 (diff)
downloadruby-de9695e3bf0048f17e1c9f3efe6bfb38d21ad3bc.tar.gz
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
-rw-r--r--ChangeLog5
-rw-r--r--configure.in1
-rw-r--r--util.c5
-rw-r--r--win32/Makefile.sub3
4 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 868bcd831e..c3858e95ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed May 11 17:18:53 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (ruby_qsort): use qsort_s if available, for Microsoft
+ Visual Studio 2005 (msvcr80.dll) and mingw.
+
Wed May 11 10:33:26 2016 Marcus Stollsteimer <sto.mar@web.de>
* COPYING: Remove trailing-whitespaces.
diff --git a/configure.in b/configure.in
index 7a90c18e7b..6c1c6cf8bf 100644
--- a/configure.in
+++ b/configure.in
@@ -2346,6 +2346,7 @@ AC_CHECK_FUNCS(posix_memalign)
AC_CHECK_FUNCS(ppoll)
AC_CHECK_FUNCS(pread)
AC_CHECK_FUNCS(qsort_r)
+AC_CHECK_FUNCS(qsort_s)
AC_CHECK_FUNCS(readlink)
AC_CHECK_FUNCS(round)
AC_CHECK_FUNCS(sched_getaffinity)
diff --git a/util.c b/util.c
index 5c89eb6947..8c428b57f0 100644
--- a/util.c
+++ b/util.c
@@ -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*);
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 06e6f5075b..b10970a6d8 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -741,6 +741,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define HAVE_TZNAME 1
#define HAVE_DAYLIGHT 1
#define HAVE_GMTIME_R 1
+!if $(RT_VER) >= 80
+#define HAVE_QSORT_S
+!endif
#define HAVE_TYPE_NET_LUID 1
#define SETPGRP_VOID 1
#define RSHIFT(x,y) ((x)>>(int)y)