[Top][All Lists]

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

bug#18354: 24.4.50; vector sorting on darwin broken

From: Jordon Biondo
Subject: bug#18354: 24.4.50; vector sorting on darwin broken
Date: Fri, 29 Aug 2014 11:24:39 -0400

Sorting vectors on a DARWIN system now segfaults due to a difference in
the order in which arguments are passed. I believe this is also the case
on bsd and others.

(sort [1 4 2] '<) ;; => seg fault

I have included my fix for my DARWIN system. I cannot test
on bsd and other. So I think it needs to be hashed out more for full
portability, but this works for my single use case.

Thank You.

*** fns.c       2014-08-29 11:02:30.000000000 -0400
--- newfns.c    2014-08-29 11:02:25.000000000 -0400
*************** static Lisp_Object sort_vector_predicate
*** 1885,1891 ****
  static int
  #ifdef HAVE_QSORT_R
! sort_vector_compare (const void *p, const void *q, void *arg)
  sort_vector_compare (const void *p, const void *q)
  #endif /* HAVE_QSORT_R */  
--- 1885,1895 ----
  static int
  #ifdef HAVE_QSORT_R
! #ifdef DARWIN_OS
! sort_vector_compare (void *arg, const void *p, const void *q)
! #else
! sort_vector_compare (const void *p, const void *q, const void *arg)
! #endif
  sort_vector_compare (const void *p, const void *q)
  #endif /* HAVE_QSORT_R */  
*************** sort_vector (Lisp_Object vector, Lisp_Ob
*** 1928,1934 ****
--- 1932,1942 ----
    /* Setup predicate and sort.  */
  #ifdef HAVE_QSORT_R
+ #ifdef DARWIN_OS
+   qsort_r (v, len, word_size, (void *) &predicate, sort_vector_compare);
+ #else
    qsort_r (v, len, word_size, sort_vector_compare, (void *) &predicate);
+ #endif
    sort_vector_predicate = predicate;
    qsort (v, len, word_size, sort_vector_compare);

In GNU Emacs (x86_64-apple-darwin13.2.0, NS appkit-1265.20 Version 
10.9.3 (Build 13D65))
of 2014-08-29 on kerbin
Configured using:
`configure --with-ns'

Configured features:

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
ESC [ > 0 ; 9 5 ; 0 c ESC x r e p o r TAB RET

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/Users/jordon/src/emacs/lisp/leim/quail/tibetan hides 
/Users/jordon/src/emacs/lisp/leim/quail/thai hides 
/Users/jordon/src/emacs/lisp/leim/quail/slovak hides 
/Users/jordon/src/emacs/lisp/leim/quail/lao hides 
/Users/jordon/src/emacs/lisp/leim/quail/japanese hides 
/Users/jordon/src/emacs/lisp/leim/quail/indian hides 
/Users/jordon/src/emacs/lisp/leim/quail/hebrew hides 
/Users/jordon/src/emacs/lisp/leim/quail/greek hides 
/Users/jordon/src/emacs/lisp/leim/quail/georgian hides 
/Users/jordon/src/emacs/lisp/leim/quail/ethiopic hides 
/Users/jordon/src/emacs/lisp/leim/quail/czech hides 
/Users/jordon/src/emacs/lisp/leim/quail/cyrillic hides 

(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util help-fns mail-prsvr mail-utils xterm time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
cocoa ns multi-tty emacs)

Memory information:
((conses 16 82723 5894)
(symbols 48 17976 0)
(miscs 40 33 99)
(strings 32 11516 4325)
(string-bytes 1 293393)
(vectors 16 7607)
(vector-slots 8 343947 26707)
(floats 8 64 289)
(intervals 56 154 0)
(buffers 976 11))

reply via email to

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