diff options
| author | Andrea Corallo | 2020-05-24 10:20:23 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-05-24 10:20:23 +0100 |
| commit | 9daffe9cfe82d3b1e1e9fa8929dbb40cfed60f0f (patch) | |
| tree | c9e78cbb4e151dc3c3996a65cf1eedab19248fb4 /src/bytecode.c | |
| parent | f5dceed09a8234548d5b3acb76d443569533cab9 (diff) | |
| parent | e021c2dc2279e0fd3a5331f9ea661e4d39c2e840 (diff) | |
| download | emacs-9daffe9cfe82d3b1e1e9fa8929dbb40cfed60f0f.tar.gz emacs-9daffe9cfe82d3b1e1e9fa8929dbb40cfed60f0f.zip | |
Merge remote-tracking branch 'savannah/master' into HEAD
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 3c90544f3f2..5ac30aa1010 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; |