diff options
| author | Paul Eggert | 2016-09-24 02:35:13 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-09-24 02:35:29 -0700 |
| commit | b3e1b382456b0f7d108c57d6f902bbddfdd97b2a (patch) | |
| tree | aa3bcb76dfb30dace2811de0612a569daf250d8d /src/font.c | |
| parent | 4f05e930ca9ca4fa87aa2bc83187590432d792bd (diff) | |
| download | emacs-b3e1b382456b0f7d108c57d6f902bbddfdd97b2a.tar.gz emacs-b3e1b382456b0f7d108c57d6f902bbddfdd97b2a.zip | |
Improve integer overflow handling a bit
* src/charset.c (read_hex): Use INT_LEFT_SHIFT_OVERFLOW for clarity.
The machine code is the same on my platform.
* src/doprnt.c (doprnt):
* src/emacs-module.c (module_funcall):
* src/font.c (font_intern_prop):
* src/keyboard.c (Frecursion_depth):
* src/lread.c (read1):
Use WRAPV macros instead of checking overflow by hand.
* src/editfns.c (hi_time, time_arith, decode_time_components):
* src/emacs-module.c (Fmodule_load):
Simplify by using FIXNUM_OVERFLOW_P.
* src/emacs-module.c: Include intprops.h.
* src/xdisp.c (percent99): New function.
(decode_mode_spec): Use it to simplify overflow avoidance and
formatting of %p and %P.
Diffstat (limited to 'src/font.c')
| -rw-r--r-- | src/font.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/font.c b/src/font.c index 144ba07c42a..f2800633b62 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -264,14 +264,13 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) | |||
| 264 | break; | 264 | break; |
| 265 | if (i == len) | 265 | if (i == len) |
| 266 | { | 266 | { |
| 267 | EMACS_INT n; | ||
| 268 | |||
| 269 | i = 0; | 267 | i = 0; |
| 270 | for (n = 0; (n += str[i++] - '0') <= MOST_POSITIVE_FIXNUM; n *= 10) | 268 | for (EMACS_INT n = 0; |
| 269 | (n += str[i++] - '0') <= MOST_POSITIVE_FIXNUM; ) | ||
| 271 | { | 270 | { |
| 272 | if (i == len) | 271 | if (i == len) |
| 273 | return make_number (n); | 272 | return make_number (n); |
| 274 | if (MOST_POSITIVE_FIXNUM / 10 < n) | 273 | if (INT_MULTIPLY_WRAPV (n, 10, &n)) |
| 275 | break; | 274 | break; |
| 276 | } | 275 | } |
| 277 | 276 | ||