aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2014-12-20 15:20:56 -0800
committerPaul Eggert2014-12-20 15:50:45 -0800
commit4cc2f6918ddd44bf1f10a1d689b7bd769fcf6b8e (patch)
tree0f92d4a3a99608cf45a3f05283144ba160ceba01
parent9b14d8b6f259a4d602f0c61689d6641e7ab20b49 (diff)
downloademacs-4cc2f6918ddd44bf1f10a1d689b7bd769fcf6b8e.tar.gz
emacs-4cc2f6918ddd44bf1f10a1d689b7bd769fcf6b8e.zip
Let charset tick grow past USHRT_MAX
* charset.c, charset.h (charset_ordered_list_tick): Now EMACS_UINT, not unsigned short. * fontset.c (reorder_font_vector): Allow the tick to grow to the maximum representable Emacs integer value before wrapping it around.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/charset.c7
-rw-r--r--src/charset.h3
-rw-r--r--src/fontset.c7
4 files changed, 14 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e21d9ee05e1..4c2f2ec59d6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
12014-12-20 Paul Eggert <eggert@cs.ucla.edu> 12014-12-20 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Let charset tick grow past USHRT_MAX
4 * charset.c, charset.h (charset_ordered_list_tick):
5 Now EMACS_UINT, not unsigned short.
6 * fontset.c (reorder_font_vector): Allow the tick to grow to the
7 maximum representable Emacs integer value before wrapping it around.
8
3 Simplify unexec file mode setting 9 Simplify unexec file mode setting
4 * unexaix.c, unexcoff.c, unexelf.c, unexmacosx.c: 10 * unexaix.c, unexcoff.c, unexelf.c, unexmacosx.c:
5 Don't include <sys/stat.h> when no longer needed. 11 Don't include <sys/stat.h> when no longer needed.
diff --git a/src/charset.c b/src/charset.c
index 171a00f23d1..9ad7de67146 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -101,10 +101,9 @@ Lisp_Object Vcharset_ordered_list;
101 charsets. */ 101 charsets. */
102Lisp_Object Vcharset_non_preferred_head; 102Lisp_Object Vcharset_non_preferred_head;
103 103
104/* Incremented everytime we change Vcharset_ordered_list. This is 104/* Incremented every time we change the priority of charsets.
105 unsigned short so that it fits in Lisp_Int and never matches 105 Wraps around. */*/
106 -1. */ 106EMACS_UINT charset_ordered_list_tick;
107unsigned short charset_ordered_list_tick;
108 107
109/* List of iso-2022 charsets. */ 108/* List of iso-2022 charsets. */
110Lisp_Object Viso_2022_charset_list; 109Lisp_Object Viso_2022_charset_list;
diff --git a/src/charset.h b/src/charset.h
index 4176ce5ecc6..6c6c3e6479f 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -253,8 +253,7 @@ extern struct charset *charset_table;
253extern Lisp_Object Vcharset_ordered_list; 253extern Lisp_Object Vcharset_ordered_list;
254extern Lisp_Object Vcharset_non_preferred_head; 254extern Lisp_Object Vcharset_non_preferred_head;
255 255
256/* Incremented everytime we change the priority of charsets. */ 256extern EMACS_UINT charset_ordered_list_tick;
257extern unsigned short charset_ordered_list_tick;
258 257
259extern Lisp_Object Viso_2022_charset_list; 258extern Lisp_Object Viso_2022_charset_list;
260extern Lisp_Object Vemacs_mule_charset_list; 259extern Lisp_Object Vemacs_mule_charset_list;
diff --git a/src/fontset.c b/src/fontset.c
index d08d68fa28d..ac50be1c925 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -389,7 +389,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
389 Lisp_Object vec, font_object; 389 Lisp_Object vec, font_object;
390 int size; 390 int size;
391 int i; 391 int i;
392 bool score_changed = 0; 392 bool score_changed = false;
393 393
394 if (font) 394 if (font)
395 XSETFONT (font_object, font); 395 XSETFONT (font_object, font);
@@ -444,14 +444,15 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
444 if (RFONT_DEF_SCORE (rfont_def) != score) 444 if (RFONT_DEF_SCORE (rfont_def) != score)
445 { 445 {
446 RFONT_DEF_SET_SCORE (rfont_def, score); 446 RFONT_DEF_SET_SCORE (rfont_def, score);
447 score_changed = 1; 447 score_changed = true;
448 } 448 }
449 } 449 }
450 450
451 if (score_changed) 451 if (score_changed)
452 qsort (XVECTOR (vec)->contents, size, word_size, 452 qsort (XVECTOR (vec)->contents, size, word_size,
453 fontset_compare_rfontdef); 453 fontset_compare_rfontdef);
454 XSETCAR (font_group, make_number (charset_ordered_list_tick)); 454 EMACS_INT low_tick_bits = charset_ordered_list_tick & MOST_POSITIVE_FIXNUM;
455 XSETCAR (font_group, make_number (low_tick_bits));
455} 456}
456 457
457/* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for 458/* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for