From: Paul Eggert Date: Sun, 27 Mar 2011 02:20:34 +0000 (-0700) Subject: * keyboard.c, keyboard.h (num_input_events): Now size_t. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~460^2~18 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ffa8c828c6c76d3c246443a6752f1038eab60413;p=emacs.git * 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/ChangeLog b/src/ChangeLog index 32f64893ae6..93c43b85184 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-03-27 Paul Eggert + * 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). diff --git a/src/keyboard.c b/src/keyboard.c index c4ef2795f6a..09a0010cedc 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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. */ diff --git a/src/keyboard.h b/src/keyboard.h index ba3c909c4dd..31215199f14 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -194,8 +194,8 @@ extern KBOARD *all_kboards; /* Nonzero in the single-kboard state, 0 in the any-kboard state. */ extern int single_kboard; -/* 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;