diff options
| author | Zach Shaftel | 2020-05-26 16:26:26 -0400 |
|---|---|---|
| committer | Zach Shaftel | 2020-05-26 16:26:26 -0400 |
| commit | b417cf03c06f0924752b1dc193726ffc94432f81 (patch) | |
| tree | aa084cd87316c822ad9caf9c0bca47573aa95f3e /src/bytecode.c | |
| parent | ef71dc437fdcdf61d61519e5197c6e3016d8f3a5 (diff) | |
| parent | 5467aac131fb49ff2af57ca21d7ec9cba7c19c82 (diff) | |
| download | emacs-b417cf03c06f0924752b1dc193726ffc94432f81.tar.gz emacs-b417cf03c06f0924752b1dc193726ffc94432f81.zip | |
Merge branch 'master' into feature/soc-bytecode-in-traceback-specbinding
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index b4b5ef6e60a..6b7e9cbc7b9 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -319,6 +319,19 @@ the third, MAXDEPTH, the maximum stack depth used in this function. | |||
| 319 | If the third argument is incorrect, Emacs may crash. */) | 319 | If the third argument is incorrect, Emacs may crash. */) |
| 320 | (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth) | 320 | (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth) |
| 321 | { | 321 | { |
| 322 | if (! (STRINGP (bytestr) && VECTORP (vector) && FIXNATP (maxdepth))) | ||
| 323 | error ("Invalid byte-code"); | ||
| 324 | |||
| 325 | if (STRING_MULTIBYTE (bytestr)) | ||
| 326 | { | ||
| 327 | /* BYTESTR must have been produced by Emacs 20.2 or earlier | ||
| 328 | because it produced a raw 8-bit string for byte-code and now | ||
| 329 | such a byte-code string is loaded as multibyte with raw 8-bit | ||
| 330 | characters converted to multibyte form. Convert them back to | ||
| 331 | the original unibyte form. */ | ||
| 332 | bytestr = Fstring_as_unibyte (bytestr); | ||
| 333 | } | ||
| 334 | |||
| 322 | return exec_byte_code (bytestr, vector, maxdepth, Qnil, 0, NULL); | 335 | return exec_byte_code (bytestr, vector, maxdepth, Qnil, 0, NULL); |
| 323 | } | 336 | } |
| 324 | 337 | ||
| @@ -344,21 +357,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 344 | int volatile this_op = 0; | 357 | int volatile this_op = 0; |
| 345 | #endif | 358 | #endif |
| 346 | 359 | ||
| 347 | CHECK_STRING (bytestr); | 360 | eassert (!STRING_MULTIBYTE (bytestr)); |
| 348 | CHECK_VECTOR (vector); | ||
| 349 | CHECK_FIXNAT (maxdepth); | ||
| 350 | 361 | ||
| 351 | ptrdiff_t const_length = ASIZE (vector); | 362 | ptrdiff_t const_length = ASIZE (vector); |
| 352 | 363 | ptrdiff_t bytestr_length = SCHARS (bytestr); | |
| 353 | if (STRING_MULTIBYTE (bytestr)) | ||
| 354 | /* BYTESTR must have been produced by Emacs 20.2 or the earlier | ||
| 355 | because they produced a raw 8-bit string for byte-code and now | ||
| 356 | such a byte-code string is loaded as multibyte while raw 8-bit | ||
| 357 | characters converted to multibyte form. Thus, now we must | ||
| 358 | convert them back to the originally intended unibyte form. */ | ||
| 359 | bytestr = Fstring_as_unibyte (bytestr); | ||
| 360 | |||
| 361 | ptrdiff_t bytestr_length = SBYTES (bytestr); | ||
| 362 | Lisp_Object *vectorp = XVECTOR (vector)->contents; | 364 | Lisp_Object *vectorp = XVECTOR (vector)->contents; |
| 363 | 365 | ||
| 364 | unsigned char quitcounter = 1; | 366 | unsigned char quitcounter = 1; |