diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c index f6f5c2c0ff8..0c58f3cc1be 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1390,10 +1390,14 @@ make_string (contents, nbytes) | |||
| 1390 | int nbytes; | 1390 | int nbytes; |
| 1391 | { | 1391 | { |
| 1392 | register Lisp_Object val; | 1392 | register Lisp_Object val; |
| 1393 | int nchars = chars_in_text (contents, nbytes); | 1393 | int nchars, multibyte_nbytes; |
| 1394 | |||
| 1395 | parse_str_as_multibyte (contents, nbytes, &nchars, &multibyte_nbytes); | ||
| 1394 | val = make_uninit_multibyte_string (nchars, nbytes); | 1396 | val = make_uninit_multibyte_string (nchars, nbytes); |
| 1395 | bcopy (contents, XSTRING (val)->data, nbytes); | 1397 | bcopy (contents, XSTRING (val)->data, nbytes); |
| 1396 | if (STRING_BYTES (XSTRING (val)) == XSTRING (val)->size) | 1398 | if (nbytes == nchars || nbytes != multibyte_nbytes) |
| 1399 | /* CONTENTS contains no multibyte sequences or contains an invalid | ||
| 1400 | multibyte sequence. We must make unibyte string. */ | ||
| 1397 | SET_STRING_BYTES (XSTRING (val), -1); | 1401 | SET_STRING_BYTES (XSTRING (val), -1); |
| 1398 | return val; | 1402 | return val; |
| 1399 | } | 1403 | } |
| @@ -1953,6 +1957,15 @@ significance.") | |||
| 1953 | val = make_pure_vector ((EMACS_INT) nargs); | 1957 | val = make_pure_vector ((EMACS_INT) nargs); |
| 1954 | else | 1958 | else |
| 1955 | val = Fmake_vector (len, Qnil); | 1959 | val = Fmake_vector (len, Qnil); |
| 1960 | |||
| 1961 | if (STRINGP (args[1]) && STRING_MULTIBYTE (args[1])) | ||
| 1962 | /* BYTECODE-STRING must have been produced by Emacs 20.2 or the | ||
| 1963 | earlier because they produced a raw 8-bit string for byte-code | ||
| 1964 | and now such a byte-code string is loaded as multibyte while | ||
| 1965 | raw 8-bit characters converted to multibyte form. Thus, now we | ||
| 1966 | must convert them back to the original unibyte form. */ | ||
| 1967 | args[1] = Fstring_as_unibyte (args[1]); | ||
| 1968 | |||
| 1956 | p = XVECTOR (val); | 1969 | p = XVECTOR (val); |
| 1957 | for (index = 0; index < nargs; index++) | 1970 | for (index = 0; index < nargs; index++) |
| 1958 | { | 1971 | { |