subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1412823 - in /subversion/trunk: aclocal.m4 build/ac-macros/qsort_r.m4 configure.ac subversion/svn_private_config.hw
Date Fri, 23 Nov 2012 11:02:25 GMT
Author: brane
Date: Fri Nov 23 11:02:24 2012
New Revision: 1412823

URL: http://svn.apache.org/viewvc?rev=1412823&view=rev
Log:
Groundwork for issue #4261 (require --force to set unknown svn: prop names).

* build/ac-macros/qsort_r.m4: New file.
  (SVN_FUNC_QSORT_R): New config test. Checks if qsort_r is available
   and if it is, determines the order of its arguments.
* aclocal.m4: Include build/ac-macros/qsort_r.m4.
* configure.ac: Call SVN_FUNC_QSORT_R.
  Define SVN_QSORT_R wrapper for subversion/svn_private_config.h

* subversion/svn_private_config.hw (SVN_QSORT_R): Define wrapper for Windows.

Added:
    subversion/trunk/build/ac-macros/qsort_r.m4
Modified:
    subversion/trunk/aclocal.m4
    subversion/trunk/configure.ac
    subversion/trunk/subversion/svn_private_config.hw

Modified: subversion/trunk/aclocal.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/aclocal.m4?rev=1412823&r1=1412822&r2=1412823&view=diff
==============================================================================
--- subversion/trunk/aclocal.m4 (original)
+++ subversion/trunk/aclocal.m4 Fri Nov 23 11:02:24 2012
@@ -47,6 +47,7 @@ sinclude(build/ac-macros/swig.m4)
 sinclude(build/ac-macros/zlib.m4)
 sinclude(build/ac-macros/kwallet.m4)
 sinclude(build/ac-macros/macosx.m4)
+sinclude(build/ac-macros/qsort_r.m4)
 
 # Include the libtool macros
 sinclude(build/libtool.m4)

Added: subversion/trunk/build/ac-macros/qsort_r.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/qsort_r.m4?rev=1412823&view=auto
==============================================================================
--- subversion/trunk/build/ac-macros/qsort_r.m4 (added)
+++ subversion/trunk/build/ac-macros/qsort_r.m4 Fri Nov 23 11:02:24 2012
@@ -0,0 +1,58 @@
+dnl ===================================================================
+dnl   Licensed to the Apache Software Foundation (ASF) under one
+dnl   or more contributor license agreements.  See the NOTICE file
+dnl   distributed with this work for additional information
+dnl   regarding copyright ownership.  The ASF licenses this file
+dnl   to you under the Apache License, Version 2.0 (the
+dnl   "License"); you may not use this file except in compliance
+dnl   with the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl   Unless required by applicable law or agreed to in writing,
+dnl   software distributed under the License is distributed on an
+dnl   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl   KIND, either express or implied.  See the License for the
+dnl   specific language governing permissions and limitations
+dnl   under the License.
+dnl ===================================================================
+dnl
+dnl   SVN_FUNC_QSORT_R()
+dnl
+dnl   Check if qsort_r or equivalent exists, and determine the order
+dnl   of the arguments.
+
+AC_DEFUN(SVN_FUNC_QSORT_R,
+[
+  AC_CHECK_FUNCS(qsort_r, [
+    AC_MSG_CHECKING([qsort_r argument order])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+          #include <stdlib.h>
+          static int reorder_args;
+          static int normal(void *c, const void *ka, const void *kb)
+          {
+            reorder_args = 0;
+            return *(int*)ka - *(int*)kb;
+          }
+          static int skewed(void *c, const void *ka, const void *kb)
+          {
+            reorder_args = 1;
+            return *(int*)ka - *(int*)kb;
+          }
+          static int check_qsort_args_order(void)
+          {
+            static int a[4] = { 5, 11, 3, 7 };
+            qsort_r(a, 4, sizeof(int), normal, skewed);
+            return reorder_args;
+          }
+    ],[
+          return check_qsort_args_order();
+    ])],[
+      AC_MSG_RESULT([normal])
+      AC_DEFINE(SVN_QSORT_R_NORMAL_ARG_ORDER, 1,
+                [Define to 1 if qsort_r takes the context as the last argument])
+    ],[
+      AC_MSG_RESULT([skewed])
+    ])
+  ], [])
+])

Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1412823&r1=1412822&r2=1412823&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Fri Nov 23 11:02:24 2012
@@ -683,6 +683,18 @@ if test "$enable_nls" = "yes"; then
 fi
 
 AH_BOTTOM([
+/* Wrap qsort_r for cross-platform compatibility */
+#if !HAVE_QSORT_R
+#define SVN_QSORT_R(base, length, width, compare, thunk) \
+  (qsort((base), (length), (width), (compare)))
+#elif SVN_QSORT_R_NORMAL_ARG_ORDER
+#define SVN_QSORT_R qsort_r
+#else
+/* BSD changes the order of the compare and thunk arguments */
+#define SVN_QSORT_R(base, length, width, compare, thunk) \
+  (qsort_r((base), (length), (width), (thunk), (compare)))
+#endif
+
 /* Indicate to translators that string X should be translated.  Do not look
    up the translation at run time; just expand to X.  This macro is suitable
    for use where a constant string is required at compile time. */
@@ -870,6 +882,9 @@ AC_FUNC_VPRINTF
 dnl check for functions needed in special file handling
 AC_CHECK_FUNCS(symlink readlink)
 
+dnl check for qsor_r presence and argument ordering
+SVN_FUNC_QSORT_R
+
 dnl check for uname
 AC_CHECK_HEADERS(sys/utsname.h, [AC_CHECK_FUNCS(uname)], [])
 

Modified: subversion/trunk/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn_private_config.hw?rev=1412823&r1=1412822&r2=1412823&view=diff
==============================================================================
--- subversion/trunk/subversion/svn_private_config.hw (original)
+++ subversion/trunk/subversion/svn_private_config.hw Fri Nov 23 11:02:24 2012
@@ -82,6 +82,8 @@
 #define SVN_APR_INT64_T_PYCFMT "L"
 #endif
 
+#define SVN_QSORT_R qsort_s
+
 /* Setup gettext macros */
 #define N_(x) x
 #define U_(x) x



Mime
View raw message