From: Paul Eggert Date: Sun, 27 Mar 2011 08:10:27 +0000 (-0700) Subject: * chartab.c (sub_char_table_ref_and_range): Redo for slight X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~460^2~16 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fe75f92609a806701f8a4d0385f3a053bc00e63d;p=emacs.git * chartab.c (sub_char_table_ref_and_range): Redo for slight efficiency gain, and to bypass a gcc -Wstrict-overflow warning. --- diff --git a/src/ChangeLog b/src/ChangeLog index 8a20c06b41c..6127bc0e8da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-03-27 Paul Eggert + * chartab.c (sub_char_table_ref_and_range): Redo for slight + efficiency gain, and to bypass a gcc -Wstrict-overflow warning. + * keyboard.c, keyboard.h (num_input_events): Now size_t. This avoids undefined behavior on integer overflow, and is a bit more convenient anyway since it is compared to a size_t variable. diff --git a/src/chartab.c b/src/chartab.c index 85aa5932ac3..9ad182131e9 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -215,7 +215,6 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); int depth = XINT (tbl->depth); int min_char = XINT (tbl->min_char); - int max_char = min_char + chartab_chars[depth - 1] - 1; int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; Lisp_Object val; @@ -244,8 +243,9 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp break; } } - while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char - && *to >= c) + while (((c = (chartab_idx + 1) * chartab_chars[depth]) + < chartab_chars[depth - 1]) + && (c += min_char) <= *to) { Lisp_Object this_val;