diff options
Diffstat (limited to 'src/callint.c')
| -rw-r--r-- | src/callint.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/callint.c b/src/callint.c index 817f84d897b..9a4573c77be 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -297,6 +297,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 297 | Lisp_Object teml; | 297 | Lisp_Object teml; |
| 298 | Lisp_Object up_event; | 298 | Lisp_Object up_event; |
| 299 | Lisp_Object enable; | 299 | Lisp_Object enable; |
| 300 | USE_SAFE_ALLOCA; | ||
| 300 | ptrdiff_t speccount = SPECPDL_INDEX (); | 301 | ptrdiff_t speccount = SPECPDL_INDEX (); |
| 301 | 302 | ||
| 302 | /* The index of the next element of this_command_keys to examine for | 303 | /* The index of the next element of this_command_keys to examine for |
| @@ -366,12 +367,8 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 366 | wrong_type_argument (Qcommandp, function); | 367 | wrong_type_argument (Qcommandp, function); |
| 367 | } | 368 | } |
| 368 | 369 | ||
| 369 | /* If SPECS is set to a string, use it as an interactive prompt. */ | 370 | /* If SPECS is not a string, invent one. */ |
| 370 | if (STRINGP (specs)) | 371 | if (! STRINGP (specs)) |
| 371 | /* Make a copy of string so that if a GC relocates specs, | ||
| 372 | `string' will still be valid. */ | ||
| 373 | string = xlispstrdupa (specs); | ||
| 374 | else | ||
| 375 | { | 372 | { |
| 376 | Lisp_Object input; | 373 | Lisp_Object input; |
| 377 | Lisp_Object funval = Findirect_function (function, Qt); | 374 | Lisp_Object funval = Findirect_function (function, Qt); |
| @@ -416,10 +413,16 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 416 | args[0] = Qfuncall_interactively; | 413 | args[0] = Qfuncall_interactively; |
| 417 | args[1] = function; | 414 | args[1] = function; |
| 418 | args[2] = specs; | 415 | args[2] = specs; |
| 419 | return unbind_to (speccount, Fapply (3, args)); | 416 | Lisp_Object result = unbind_to (speccount, Fapply (3, args)); |
| 417 | SAFE_FREE (); | ||
| 418 | return result; | ||
| 420 | } | 419 | } |
| 421 | } | 420 | } |
| 422 | 421 | ||
| 422 | /* SPECS is set to a string; use it as an interactive prompt. | ||
| 423 | Copy it so that STRING will be valid even if a GC relocates SPECS. */ | ||
| 424 | SAFE_ALLOCA_STRING (string, specs); | ||
| 425 | |||
| 423 | /* Here if function specifies a string to control parsing the defaults. */ | 426 | /* Here if function specifies a string to control parsing the defaults. */ |
| 424 | 427 | ||
| 425 | /* Set next_event to point to the first event with parameters. */ | 428 | /* Set next_event to point to the first event with parameters. */ |
| @@ -507,14 +510,15 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 507 | break; | 510 | break; |
| 508 | } | 511 | } |
| 509 | 512 | ||
| 510 | if (min (MOST_POSITIVE_FIXNUM, | 513 | if (MOST_POSITIVE_FIXNUM < min (PTRDIFF_MAX, SIZE_MAX) / word_size |
| 511 | min (PTRDIFF_MAX, SIZE_MAX) / word_size) | 514 | && MOST_POSITIVE_FIXNUM < nargs) |
| 512 | < nargs) | ||
| 513 | memory_full (SIZE_MAX); | 515 | memory_full (SIZE_MAX); |
| 514 | 516 | ||
| 515 | args = alloca (nargs * sizeof *args); | 517 | /* Allocate them all at one go. This wastes a bit of memory, but |
| 516 | visargs = alloca (nargs * sizeof *visargs); | 518 | it's OK to trade space for speed. */ |
| 517 | varies = alloca (nargs * sizeof *varies); | 519 | SAFE_NALLOCA (args, 3, nargs); |
| 520 | visargs = args + nargs; | ||
| 521 | varies = (signed char *) (visargs + nargs); | ||
| 518 | 522 | ||
| 519 | for (i = 0; i < nargs; i++) | 523 | for (i = 0; i < nargs; i++) |
| 520 | { | 524 | { |
| @@ -871,7 +875,9 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 871 | { | 875 | { |
| 872 | Lisp_Object val = Ffuncall (nargs, args); | 876 | Lisp_Object val = Ffuncall (nargs, args); |
| 873 | UNGCPRO; | 877 | UNGCPRO; |
| 874 | return unbind_to (speccount, val); | 878 | val = unbind_to (speccount, val); |
| 879 | SAFE_FREE (); | ||
| 880 | return val; | ||
| 875 | } | 881 | } |
| 876 | } | 882 | } |
| 877 | 883 | ||