diff options
| author | Stefan Monnier | 2012-03-09 11:46:25 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2012-03-09 11:46:25 -0500 |
| commit | cae070000107848cd082496e14cf5851cc1f2c25 (patch) | |
| tree | 359bcc430193765f6012a6115e87e6552eb1208c /src | |
| parent | 4f96ea3f4fbe8950c0d281da836897fb8394a812 (diff) | |
| download | emacs-cae070000107848cd082496e14cf5851cc1f2c25.tar.gz emacs-cae070000107848cd082496e14cf5851cc1f2c25.zip | |
* src/buffer.c (compare_overlays): Avoid qsort's instability.
Fixes: debbugs:6830
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/buffer.c | 6 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f623e9d46e7..b984064e26c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-03-09 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * buffer.c (compare_overlays): Avoid qsort's instability (bug#6830). | ||
| 4 | |||
| 1 | 2012-03-08 Jan Djärv <jan.h.d@swipnet.se> | 5 | 2012-03-08 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 6 | ||
| 3 | * gtkutil.c (x_wm_set_size_hint): Use one row in call to | 7 | * gtkutil.c (x_wm_set_size_hint): Use one row in call to |
| @@ -201,8 +205,8 @@ | |||
| 201 | 205 | ||
| 202 | 2012-02-04 Eli Zaretskii <eliz@gnu.org> | 206 | 2012-02-04 Eli Zaretskii <eliz@gnu.org> |
| 203 | 207 | ||
| 204 | * w32.c (get_emacs_configuration_options): Include | 208 | * w32.c (get_emacs_configuration_options): |
| 205 | --enable-checking, if specified, in the return value. | 209 | Include --enable-checking, if specified, in the return value. |
| 206 | 210 | ||
| 207 | 2012-02-04 Martin Rudalics <rudalics@gmx.at> | 211 | 2012-02-04 Martin Rudalics <rudalics@gmx.at> |
| 208 | 212 | ||
| @@ -308,8 +312,8 @@ | |||
| 308 | 2012-01-19 Martin Rudalics <rudalics@gmx.at> | 312 | 2012-01-19 Martin Rudalics <rudalics@gmx.at> |
| 309 | 313 | ||
| 310 | * window.c (save_window_save, Fcurrent_window_configuration) | 314 | * window.c (save_window_save, Fcurrent_window_configuration) |
| 311 | (Vwindow_persistent_parameters): Do not use Qstate. Rewrite | 315 | (Vwindow_persistent_parameters): Do not use Qstate. |
| 312 | doc-strings. | 316 | Rewrite doc-strings. |
| 313 | 317 | ||
| 314 | 2012-01-19 Kenichi Handa <handa@m17n.org> | 318 | 2012-01-19 Kenichi Handa <handa@m17n.org> |
| 315 | 319 | ||
| @@ -483,9 +487,9 @@ | |||
| 483 | * nsselect.m (CUT_BUFFER_SUPPORT): Remove define. | 487 | * nsselect.m (CUT_BUFFER_SUPPORT): Remove define. |
| 484 | (symbol_to_nsstring): Fix indentation. | 488 | (symbol_to_nsstring): Fix indentation. |
| 485 | (ns_symbol_to_pb): New function. | 489 | (ns_symbol_to_pb): New function. |
| 486 | (Fns_get_selection_internal): Renamed from Fns_get_cut_buffer_internal. | 490 | (Fns_get_selection_internal): Rename from Fns_get_cut_buffer_internal. |
| 487 | (Fns_rotate_cut_buffers_internal): Removed. | 491 | (Fns_rotate_cut_buffers_internal): Remove. |
| 488 | (Fns_store_selection_internal): Renamed from | 492 | (Fns_store_selection_internal): Rename from |
| 489 | Fns_store_cut_buffer_internal. | 493 | Fns_store_cut_buffer_internal. |
| 490 | (ns_get_foreign_selection, Fx_own_selection_internal) | 494 | (ns_get_foreign_selection, Fx_own_selection_internal) |
| 491 | (Fx_disown_selection_internal, Fx_selection_exists_p) | 495 | (Fx_disown_selection_internal, Fx_selection_exists_p) |
| @@ -626,7 +630,7 @@ | |||
| 626 | (coding_set_destination): Return how many bytes | 630 | (coding_set_destination): Return how many bytes |
| 627 | coding->destination was relocated. | 631 | coding->destination was relocated. |
| 628 | (CODING_DECODE_CHAR, CODING_ENCODE_CHAR, CODING_CHAR_CHARSET) | 632 | (CODING_DECODE_CHAR, CODING_ENCODE_CHAR, CODING_CHAR_CHARSET) |
| 629 | (CODING_CHAR_CHARSET_P): Adjusted for the avove changes. | 633 | (CODING_CHAR_CHARSET_P): Adjust for the avove changes. |
| 630 | 634 | ||
| 631 | 2011-12-05 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change) | 635 | 2011-12-05 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny change) |
| 632 | 636 | ||
diff --git a/src/buffer.c b/src/buffer.c index 1577254d92a..efb9a80f35d 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2864,7 +2864,11 @@ compare_overlays (const void *v1, const void *v2) | |||
| 2864 | return s1->beg < s2->beg ? -1 : 1; | 2864 | return s1->beg < s2->beg ? -1 : 1; |
| 2865 | if (s1->end != s2->end) | 2865 | if (s1->end != s2->end) |
| 2866 | return s2->end < s1->end ? -1 : 1; | 2866 | return s2->end < s1->end ? -1 : 1; |
| 2867 | return 0; | 2867 | /* Avoid the non-determinism of qsort by choosing an arbitrary ordering |
| 2868 | between "equal" overlays. The result can still change between | ||
| 2869 | invocations of Emacs, but it won't change in the middle of | ||
| 2870 | `find_field' (bug#6830). */ | ||
| 2871 | return XHASH (s1->overlay) < XHASH (s2->overlay) ? -1 : 1; | ||
| 2868 | } | 2872 | } |
| 2869 | 2873 | ||
| 2870 | /* Sort an array of overlays by priority. The array is modified in place. | 2874 | /* Sort an array of overlays by priority. The array is modified in place. |