emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117769: Fix last change to support Darwin/OSX (Bug#


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117769: Fix last change to support Darwin/OSX (Bug#18354).
Date: Fri, 29 Aug 2014 16:22:18 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117769
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2014-08-29 20:21:30 +0400
message:
  Fix last change to support Darwin/OSX (Bug#18354).
  * sysdep.c (sort_vector_compare) [DARWIN_OS || __FreeBSD__]:
  Conditionally define to match system's qsort_r signature.
  (sort_vector) [DARWIN_OS || __FreeBSD__]: Likewise in call to qsort_r.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/fns.c                      fns.c-20091113204419-o5vbwnq5f7feedwu-203
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-08-29 07:29:47 +0000
+++ b/src/ChangeLog     2014-08-29 16:21:30 +0000
@@ -9,6 +9,11 @@
        * lisp.h (enum Lisp_Save_Type): New member SAVE_TYPE_INT_OBJ.
        (make_save_int_obj): Add prototype.
 
+       Fix last change to support Darwin/OSX (Bug#18354).
+       * sysdep.c (sort_vector_compare) [DARWIN_OS || __FreeBSD__]:
+       Conditionally define to match system's qsort_r signature.
+       (sort_vector) [DARWIN_OS || __FreeBSD__]: Likewise in call to qsort_r.
+
 2014-08-28  Ken Brown  <address@hidden>
 
        Add support for HYBRID_MALLOC, allowing the use of gmalloc before

=== modified file 'src/fns.c'
--- a/src/fns.c 2014-08-29 11:02:56 +0000
+++ b/src/fns.c 2014-08-29 16:21:30 +0000
@@ -1876,7 +1876,8 @@
   return merge (front, back, predicate);
 }
 
-/* Using GNU qsort_r, we can pass this as a parameter.  */
+/* Using GNU qsort_r, we can pass this as a parameter.  This also
+   exists on FreeBSD and Darwin/OSX, but with a different signature. */
 #ifndef HAVE_QSORT_R
 static Lisp_Object sort_vector_predicate;
 #endif
@@ -1885,16 +1886,22 @@
 
 static int
 #ifdef HAVE_QSORT_R
+#if defined (DARWIN_OS) || defined (__FreeBSD__)
+sort_vector_compare (void *arg, const void *p, const void *q)
+#elif defined (GNU_LINUX)
 sort_vector_compare (const void *p, const void *q, void *arg)
-#else
+#else /* neither darwin/bsd nor gnu/linux */
+#error "check how qsort_r comparison function works on your platform"
+#endif /* DARWIN_OS || __FreeBSD__ */
+#else /* not HAVE_QSORT_R */
 sort_vector_compare (const void *p, const void *q)
-#endif /* HAVE_QSORT_R */  
+#endif /* HAVE_QSORT_R */
 {
   bool more, less;
   Lisp_Object op, oq, vp, vq;
 #ifdef HAVE_QSORT_R
   Lisp_Object sort_vector_predicate = *(Lisp_Object *) arg;
-#endif  
+#endif
 
   op = *(Lisp_Object *) p;
   oq = *(Lisp_Object *) q;
@@ -1928,8 +1935,14 @@
 
   /* Setup predicate and sort.  */
 #ifdef HAVE_QSORT_R
+#if defined (DARWIN_OS) || defined (__FreeBSD__)
+  qsort_r (v, len, word_size, (void *) &predicate, sort_vector_compare);
+#elif defined (GNU_LINUX)
   qsort_r (v, len, word_size, sort_vector_compare, (void *) &predicate);
-#else  
+#else /* neither darwin/bsd nor gnu/linux */
+#error "check how qsort_r works on your platform"
+#endif /* DARWIN_OS || __FreeBSD__ */
+#else /* not HAVE_QSORT_R */
   sort_vector_predicate = predicate;
   qsort (v, len, word_size, sort_vector_compare);
 #endif /* HAVE_QSORT_R */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]