diff options
| author | Paul Eggert | 2011-08-29 12:07:18 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-08-29 12:07:18 -0700 |
| commit | 48e3079369b75be22bcc429bc77bc5e61843562d (patch) | |
| tree | 9d6e3b1d64043147bb10da612ceb16f0b38b5836 /src | |
| parent | 0df02bf3e941de4c20a7174e8233357eeca738d5 (diff) | |
| download | emacs-48e3079369b75be22bcc429bc77bc5e61843562d.tar.gz emacs-48e3079369b75be22bcc429bc77bc5e61843562d.zip | |
* macros.c (executing_kbd_macro_iterations): Now EMACS_INT, not int.
(Fend_kbd_macro): Don't mishandle MOST_NEGATIVE_FIXNUM by treating
it as a large positive number.
(Fexecute_kbd_macro): Don't assume repeat count fits in int.
* macros.h (executing_kbd_macro_iterations): Now EMACS_INT, not int.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/macros.c | 12 | ||||
| -rw-r--r-- | src/macros.h | 3 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ac83d07cba5..b69830b23a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -68,6 +68,12 @@ | |||
| 68 | * lread.c (dir_warning): Don't blindly alloca buffer; use SAFE_ALLOCA. | 68 | * lread.c (dir_warning): Don't blindly alloca buffer; use SAFE_ALLOCA. |
| 69 | Use esprintf, not sprintf, in case result does not fit in int. | 69 | Use esprintf, not sprintf, in case result does not fit in int. |
| 70 | 70 | ||
| 71 | * macros.c (executing_kbd_macro_iterations): Now EMACS_INT, not int. | ||
| 72 | (Fend_kbd_macro): Don't mishandle MOST_NEGATIVE_FIXNUM by treating | ||
| 73 | it as a large positive number. | ||
| 74 | (Fexecute_kbd_macro): Don't assume repeat count fits in int. | ||
| 75 | * macros.h (executing_kbd_macro_iterations): Now EMACS_INT, not int. | ||
| 76 | |||
| 71 | 2011-08-26 Paul Eggert <eggert@cs.ucla.edu> | 77 | 2011-08-26 Paul Eggert <eggert@cs.ucla.edu> |
| 72 | 78 | ||
| 73 | Integer and memory overflow issues (Bug#9196). | 79 | Integer and memory overflow issues (Bug#9196). |
diff --git a/src/macros.c b/src/macros.c index f6cd3a3ccad..4ecf49834a1 100644 --- a/src/macros.c +++ b/src/macros.c | |||
| @@ -35,7 +35,7 @@ static Lisp_Object Qkbd_macro_termination_hook; | |||
| 35 | This is not bound at each level, | 35 | This is not bound at each level, |
| 36 | so after an error, it describes the innermost interrupted macro. */ | 36 | so after an error, it describes the innermost interrupted macro. */ |
| 37 | 37 | ||
| 38 | int executing_kbd_macro_iterations; | 38 | EMACS_INT executing_kbd_macro_iterations; |
| 39 | 39 | ||
| 40 | /* This is the macro that was executing. | 40 | /* This is the macro that was executing. |
| 41 | This is not bound at each level, | 41 | This is not bound at each level, |
| @@ -175,11 +175,11 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) | |||
| 175 | 175 | ||
| 176 | if (XFASTINT (repeat) == 0) | 176 | if (XFASTINT (repeat) == 0) |
| 177 | Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc); | 177 | Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc); |
| 178 | else | 178 | else if (XINT (repeat) > 1) |
| 179 | { | 179 | { |
| 180 | XSETINT (repeat, XINT (repeat)-1); | 180 | XSETINT (repeat, XINT (repeat)-1); |
| 181 | if (XINT (repeat) > 0) | 181 | Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), |
| 182 | Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro), repeat, loopfunc); | 182 | repeat, loopfunc); |
| 183 | } | 183 | } |
| 184 | return Qnil; | 184 | return Qnil; |
| 185 | } | 185 | } |
| @@ -302,9 +302,9 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) | |||
| 302 | Lisp_Object final; | 302 | Lisp_Object final; |
| 303 | Lisp_Object tem; | 303 | Lisp_Object tem; |
| 304 | int pdlcount = SPECPDL_INDEX (); | 304 | int pdlcount = SPECPDL_INDEX (); |
| 305 | int repeat = 1; | 305 | EMACS_INT repeat = 1; |
| 306 | struct gcpro gcpro1, gcpro2; | 306 | struct gcpro gcpro1, gcpro2; |
| 307 | int success_count = 0; | 307 | EMACS_INT success_count = 0; |
| 308 | 308 | ||
| 309 | executing_kbd_macro_iterations = 0; | 309 | executing_kbd_macro_iterations = 0; |
| 310 | 310 | ||
diff --git a/src/macros.h b/src/macros.h index 32a97e457e8..7a5d532fbb7 100644 --- a/src/macros.h +++ b/src/macros.h | |||
| @@ -22,7 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | This is not bound at each level, | 22 | This is not bound at each level, |
| 23 | so after an error, it describes the innermost interrupted macro. */ | 23 | so after an error, it describes the innermost interrupted macro. */ |
| 24 | 24 | ||
| 25 | extern int executing_kbd_macro_iterations; | 25 | extern EMACS_INT executing_kbd_macro_iterations; |
| 26 | 26 | ||
| 27 | /* This is the macro that was executing. | 27 | /* This is the macro that was executing. |
| 28 | This is not bound at each level, | 28 | This is not bound at each level, |
| @@ -42,4 +42,3 @@ extern void finalize_kbd_macro_chars (void); | |||
| 42 | /* Store a character into kbd macro being defined */ | 42 | /* Store a character into kbd macro being defined */ |
| 43 | 43 | ||
| 44 | extern void store_kbd_macro_char (Lisp_Object); | 44 | extern void store_kbd_macro_char (Lisp_Object); |
| 45 | |||