* keyboard.c, keyboard.h (num_input_events): Now size_t.
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 27 Mar 2011 02:20:34 +0000 (19:20 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 27 Mar 2011 02:20:34 +0000 (19:20 -0700)
This avoids undefined behavior on integer overflow, and is a bit
more convenient anyway since it is compared to a size_t variable.

src/ChangeLog
src/keyboard.c
src/keyboard.h

index 32f6489..93c43b8 100644 (file)
@@ -1,5 +1,9 @@
 2011-03-27  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * 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.
+
        Variadic C functions now count arguments with size_t, not int.
        This avoids an unnecessary limitation on 64-bit machines, which
        caused (substring ...) to crash on large vectors (Bug#8344).
index c4ef279..09a0010 100644 (file)
@@ -201,8 +201,8 @@ Lisp_Object unread_switch_frame;
 /* Last size recorded for a current buffer which is not a minibuffer.  */
 static EMACS_INT last_non_minibuf_size;
 
-/* Total number of times read_char has returned.  */
-int num_input_events;
+/* Total number of times read_char has returned, modulo SIZE_MAX + 1.  */
+size_t num_input_events;
 
 /* Value of num_nonmacro_input_events as of last auto save.  */
 
index ba3c909..3121519 100644 (file)
@@ -194,8 +194,8 @@ extern KBOARD *all_kboards;
 /* Nonzero in the single-kboard state, 0 in the any-kboard state.  */
 extern int single_kboard;
 \f
-/* Total number of times read_char has returned.  */
-extern int num_input_events;
+/* Total number of times read_char has returned, modulo SIZE_MAX + 1.  */
+extern size_t num_input_events;
 
 /* Nonzero means polling for input is temporarily suppressed.  */
 extern int poll_suppress_count;