aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorPaul Eggert2016-09-24 02:35:13 -0700
committerPaul Eggert2016-09-24 02:35:29 -0700
commitb3e1b382456b0f7d108c57d6f902bbddfdd97b2a (patch)
treeaa3bcb76dfb30dace2811de0612a569daf250d8d /src/keyboard.c
parent4f05e930ca9ca4fa87aa2bc83187590432d792bd (diff)
downloademacs-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/keyboard.c')
-rw-r--r--src/keyboard.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index b8bc3610eb0..ca40c6e7ad0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10058,11 +10058,9 @@ DEFUN ("recursion-depth", Frecursion_depth, Srecursion_depth, 0, 0, 0,
10058 doc: /* Return the current depth in recursive edits. */) 10058 doc: /* Return the current depth in recursive edits. */)
10059 (void) 10059 (void)
10060{ 10060{
10061 Lisp_Object temp; 10061 EMACS_INT sum;
10062 /* Wrap around reliably on integer overflow. */ 10062 INT_ADD_WRAPV (command_loop_level, minibuf_level, &sum);
10063 EMACS_INT sum = (command_loop_level & INTMASK) + (minibuf_level & INTMASK); 10063 return make_number (sum);
10064 XSETINT (temp, sum);
10065 return temp;
10066} 10064}
10067 10065
10068DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1, 10066DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1,