From: Paul Eggert Date: Sat, 20 Dec 2014 23:20:56 +0000 (-0800) Subject: Let charset tick grow past USHRT_MAX X-Git-Tag: emacs-25.0.90~2635^2~11 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4cc2f6918ddd44bf1f10a1d689b7bd769fcf6b8e;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index e21d9ee05e1..4c2f2ec59d6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2014-12-20 Paul Eggert + 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. + Simplify unexec file mode setting * unexaix.c, unexcoff.c, unexelf.c, unexmacosx.c: Don't include 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; charsets. */ Lisp_Object Vcharset_non_preferred_head; -/* Incremented everytime we change Vcharset_ordered_list. This is - unsigned short so that it fits in Lisp_Int and never matches - -1. */ -unsigned short charset_ordered_list_tick; +/* Incremented every time we change the priority of charsets. + Wraps around. */*/ +EMACS_UINT charset_ordered_list_tick; /* List of iso-2022 charsets. */ Lisp_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; extern Lisp_Object Vcharset_ordered_list; extern Lisp_Object Vcharset_non_preferred_head; -/* Incremented everytime we change the priority of charsets. */ -extern unsigned short charset_ordered_list_tick; +extern EMACS_UINT charset_ordered_list_tick; extern Lisp_Object Viso_2022_charset_list; extern 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) Lisp_Object vec, font_object; int size; int i; - bool score_changed = 0; + bool score_changed = false; if (font) XSETFONT (font_object, font); @@ -444,14 +444,15 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) if (RFONT_DEF_SCORE (rfont_def) != score) { RFONT_DEF_SET_SCORE (rfont_def, score); - score_changed = 1; + score_changed = true; } } if (score_changed) qsort (XVECTOR (vec)->contents, size, word_size, fontset_compare_rfontdef); - XSETCAR (font_group, make_number (charset_ordered_list_tick)); + EMACS_INT low_tick_bits = charset_ordered_list_tick & MOST_POSITIVE_FIXNUM; + XSETCAR (font_group, make_number (low_tick_bits)); } /* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for