ruby-changes:42900
From: nobu <ko1@a...>
Date: Wed, 11 May 2016 16:22:21 +0900 (JST)
Subject: [ruby-changes:42900] nobu:r54974 (trunk): util.c: qsort_s
nobu 2016-05-11 17:18:56 +0900 (Wed, 11 May 2016) New Revision: 54974 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54974 Log: util.c: qsort_s * util.c (ruby_qsort): use qsort_s if available, for Microsoft Visual Studio 2005 (msvcr80.dll) and mingw. Modified files: trunk/ChangeLog trunk/configure.in trunk/util.c trunk/win32/Makefile.sub Index: util.c =================================================================== --- util.c (revision 54973) +++ util.c (revision 54974) @@ -191,6 +191,11 @@ ruby_strtoul(const char *str, char **end https://github.com/ruby/ruby/blob/trunk/util.c#L191 # 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*); Index: win32/Makefile.sub =================================================================== --- win32/Makefile.sub (revision 54973) +++ win32/Makefile.sub (revision 54974) @@ -741,6 +741,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/ https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L741 #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) Index: configure.in =================================================================== --- configure.in (revision 54973) +++ configure.in (revision 54974) @@ -2346,6 +2346,7 @@ AC_CHECK_FUNCS(posix_memalign) https://github.com/ruby/ruby/blob/trunk/configure.in#L2346 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) Index: ChangeLog =================================================================== --- ChangeLog (revision 54973) +++ ChangeLog (revision 54974) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed May 11 17:18:53 2016 Nobuyoshi Nakada <nobu@r...> + + * 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@w...> * COPYING: Remove trailing-whitespaces. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/