diff options
| author | Karl Heuer | 1994-05-25 02:22:08 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-05-25 02:22:08 +0000 |
| commit | de65837bbeb778bea2ec11c73eaf60e566313683 (patch) | |
| tree | 59d929fd001ee0d31d2a3726ded9888b8eca64ea /src/undo.c | |
| parent | 55b4889367642198d2e7ea44e338bbe191414d97 (diff) | |
| download | emacs-de65837bbeb778bea2ec11c73eaf60e566313683.tar.gz emacs-de65837bbeb778bea2ec11c73eaf60e566313683.zip | |
(Fprimitive_undo): GCPRO next and list.
Check argument type before calling XINT.
Diffstat (limited to 'src/undo.c')
| -rw-r--r-- | src/undo.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/undo.c b/src/undo.c index 4733694ff31..fef2698c759 100644 --- a/src/undo.c +++ b/src/undo.c | |||
| @@ -335,8 +335,10 @@ Return what remains of the list.") | |||
| 335 | (n, list) | 335 | (n, list) |
| 336 | Lisp_Object n, list; | 336 | Lisp_Object n, list; |
| 337 | { | 337 | { |
| 338 | struct gcpro gcpro1, gcpro2; | ||
| 339 | Lisp_Object next; | ||
| 338 | int count = specpdl_ptr - specpdl; | 340 | int count = specpdl_ptr - specpdl; |
| 339 | register int arg = XINT (n); | 341 | register int arg; |
| 340 | #if 0 /* This is a good feature, but would make undo-start | 342 | #if 0 /* This is a good feature, but would make undo-start |
| 341 | unable to do what is expected. */ | 343 | unable to do what is expected. */ |
| 342 | Lisp_Object tem; | 344 | Lisp_Object tem; |
| @@ -348,6 +350,11 @@ Return what remains of the list.") | |||
| 348 | list = Fcdr (list); | 350 | list = Fcdr (list); |
| 349 | #endif | 351 | #endif |
| 350 | 352 | ||
| 353 | CHECK_NUMBER (n, 0); | ||
| 354 | arg = XINT (n); | ||
| 355 | next = Qnil; | ||
| 356 | GCPRO2 (next, list); | ||
| 357 | |||
| 351 | /* Don't let read-only properties interfere with undo. */ | 358 | /* Don't let read-only properties interfere with undo. */ |
| 352 | if (NILP (current_buffer->read_only)) | 359 | if (NILP (current_buffer->read_only)) |
| 353 | specbind (Qinhibit_read_only, Qt); | 360 | specbind (Qinhibit_read_only, Qt); |
| @@ -356,7 +363,6 @@ Return what remains of the list.") | |||
| 356 | { | 363 | { |
| 357 | while (1) | 364 | while (1) |
| 358 | { | 365 | { |
| 359 | Lisp_Object next; | ||
| 360 | next = Fcar (list); | 366 | next = Fcar (list); |
| 361 | list = Fcdr (list); | 367 | list = Fcdr (list); |
| 362 | /* Exit inner loop at undo boundary. */ | 368 | /* Exit inner loop at undo boundary. */ |
| @@ -455,6 +461,7 @@ Return what remains of the list.") | |||
| 455 | arg--; | 461 | arg--; |
| 456 | } | 462 | } |
| 457 | 463 | ||
| 464 | UNGCPRO; | ||
| 458 | return unbind_to (count, list); | 465 | return unbind_to (count, list); |
| 459 | } | 466 | } |
| 460 | 467 | ||