Mercurial > emacs
comparison src/fns.c @ 49815:2a19e12053a4
(string_to_multibyte): Always return a multibyte string.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 17 Feb 2003 00:32:12 +0000 |
parents | 48a58e6b11cc |
children | 95557d4395b0 |
comparison
equal
deleted
inserted
replaced
49814:18c02ae69126 | 49815:2a19e12053a4 |
---|---|
1051 | 1051 |
1052 if (STRING_MULTIBYTE (string)) | 1052 if (STRING_MULTIBYTE (string)) |
1053 return string; | 1053 return string; |
1054 | 1054 |
1055 nbytes = parse_str_to_multibyte (SDATA (string), SBYTES (string)); | 1055 nbytes = parse_str_to_multibyte (SDATA (string), SBYTES (string)); |
1056 /* If all the chars are ASCII, they won't need any more bytes | 1056 /* If all the chars are ASCII or eight-bit-graphic, they won't need |
1057 once converted. In that case, we can return STRING itself. */ | 1057 any more bytes once converted. */ |
1058 if (nbytes == SBYTES (string)) | 1058 if (nbytes == SBYTES (string)) |
1059 return string; | 1059 return make_multibyte_string (SDATA (string), nbytes, nbytes); |
1060 | 1060 |
1061 buf = (unsigned char *) alloca (nbytes); | 1061 buf = (unsigned char *) alloca (nbytes); |
1062 bcopy (SDATA (string), buf, SBYTES (string)); | 1062 bcopy (SDATA (string), buf, SBYTES (string)); |
1063 str_to_multibyte (buf, nbytes, SBYTES (string)); | 1063 str_to_multibyte (buf, nbytes, SBYTES (string)); |
1064 | 1064 |