diff options
| author | Paul Eggert | 2011-03-27 01:10:27 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-27 01:10:27 -0700 |
| commit | fe75f92609a806701f8a4d0385f3a053bc00e63d (patch) | |
| tree | bfad3c172a8b40e21cbcc57e004ac8b7f5789262 /src | |
| parent | 4a843dd730dc1d209fb759136460dc411b299616 (diff) | |
| download | emacs-fe75f92609a806701f8a4d0385f3a053bc00e63d.tar.gz emacs-fe75f92609a806701f8a4d0385f3a053bc00e63d.zip | |
* chartab.c (sub_char_table_ref_and_range): Redo for slight
efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/chartab.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8a20c06b41c..6127bc0e8da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-03-27 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-03-27 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * chartab.c (sub_char_table_ref_and_range): Redo for slight | ||
| 4 | efficiency gain, and to bypass a gcc -Wstrict-overflow warning. | ||
| 5 | |||
| 3 | * keyboard.c, keyboard.h (num_input_events): Now size_t. | 6 | * keyboard.c, keyboard.h (num_input_events): Now size_t. |
| 4 | This avoids undefined behavior on integer overflow, and is a bit | 7 | This avoids undefined behavior on integer overflow, and is a bit |
| 5 | more convenient anyway since it is compared to a size_t variable. | 8 | 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 | |||
| 215 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 215 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 216 | int depth = XINT (tbl->depth); | 216 | int depth = XINT (tbl->depth); |
| 217 | int min_char = XINT (tbl->min_char); | 217 | int min_char = XINT (tbl->min_char); |
| 218 | int max_char = min_char + chartab_chars[depth - 1] - 1; | ||
| 219 | int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; | 218 | int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; |
| 220 | Lisp_Object val; | 219 | Lisp_Object val; |
| 221 | 220 | ||
| @@ -244,8 +243,9 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp | |||
| 244 | break; | 243 | break; |
| 245 | } | 244 | } |
| 246 | } | 245 | } |
| 247 | while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char | 246 | while (((c = (chartab_idx + 1) * chartab_chars[depth]) |
| 248 | && *to >= c) | 247 | < chartab_chars[depth - 1]) |
| 248 | && (c += min_char) <= *to) | ||
| 249 | { | 249 | { |
| 250 | Lisp_Object this_val; | 250 | Lisp_Object this_val; |
| 251 | 251 | ||