diff options
| author | Paul Eggert | 2014-08-30 15:59:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-08-30 15:59:39 -0700 |
| commit | f9caea823350640fb03195c73c301f08ce932bd0 (patch) | |
| tree | be0e02155cf2f218c61379dde8ac98f100553392 /admin | |
| parent | 88366fcf88e5bccc4d0bcff798beb3ef27aaa496 (diff) | |
| download | emacs-f9caea823350640fb03195c73c301f08ce932bd0.tar.gz emacs-f9caea823350640fb03195c73c301f08ce932bd0.zip | |
Vector-sorting fixes.
It's not safe to call qsort or qsort_r, since they have undefined
behavior if the user-specified predicate is not a total order.
Also, watch out for garbage-collection while sorting vectors.
* admin/merge-gnulib (GNULIB_MODULES): Add vla.
* configure.ac (qsort_r): Remove, as we no longer use qsort-like
functions.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/vla.h, m4/vararrays.m4: New files, copied from gnulib.
* lib/stdlib.in.h, m4/stdlib_h.m4: Sync from gnulib, incorporating:
2014-08-29 qsort_r: new module, for GNU-style qsort_r
The previous two files' changes are boilerplate generated by
admin/merge-gnulib, and should not affect Emacs.
* src/fns.c: Include <vla.h>.
(sort_vector_predicate) [!HAVE_QSORT_R]: Remove.
(sort_vector_compare): Remove, replacing with ....
(inorder, merge_vectors, sort_vector_inplace, sort_vector_copy):
... these new functions.
(sort_vector): Rewrite to use the new functions.
GCPRO locals, since the predicate can invoke the GC.
Since it's in-place return void; caller changed.
(merge): Use 'inorder', for clarity.
Fixes: debbugs:18361
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/ChangeLog | 5 | ||||
| -rwxr-xr-x | admin/merge-gnulib | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index f4bfa73911c..bbb673beddf 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-08-30 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Vector-sorting fixes (Bug#18361). | ||
| 4 | * merge-gnulib (GNULIB_MODULES): Add vla. | ||
| 5 | |||
| 1 | 2014-08-30 Eli Zaretskii <eliz@gnu.org> | 6 | 2014-08-30 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * authors.el (authors): Fix last change so it works for MS-Windows | 8 | * authors.el (authors): Fix last change so it works for MS-Windows |
diff --git a/admin/merge-gnulib b/admin/merge-gnulib index a11b6e06d27..5b9b716bed2 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib | |||
| @@ -39,7 +39,7 @@ GNULIB_MODULES=' | |||
| 39 | strftime strtoimax strtoumax symlink sys_stat | 39 | strftime strtoimax strtoumax symlink sys_stat |
| 40 | sys_time time timer-time timespec-add timespec-sub | 40 | sys_time time timer-time timespec-add timespec-sub |
| 41 | unsetenv update-copyright utimens | 41 | unsetenv update-copyright utimens |
| 42 | warnings | 42 | vla warnings |
| 43 | ' | 43 | ' |
| 44 | 44 | ||
| 45 | GNULIB_TOOL_FLAGS=' | 45 | GNULIB_TOOL_FLAGS=' |