Mercurial > emacs
changeset 35997:d04b544d2a18
(Fstring): If all arguments are less than 256, return a unibyte
string.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 09 Feb 2001 05:32:24 +0000 |
parents | 3d6ad164318c |
children | 5cf8398ba424 |
files | src/charset.c |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/charset.c Fri Feb 09 05:29:17 2001 +0000 +++ b/src/charset.c Fri Feb 09 05:32:24 2001 +0000 @@ -1619,12 +1619,22 @@ unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n); unsigned char *p = buf; int c; + int multibyte = 0; for (i = 0; i < n; i++) { CHECK_NUMBER (args[i], 0); + if (!multibyte && !SINGLE_BYTE_CHAR_P (XFASTINT (args[i]))) + multibyte = 1; + } + + for (i = 0; i < n; i++) + { c = XINT (args[i]); - p += CHAR_STRING (c, p); + if (multibyte) + p += CHAR_STRING (c, p); + else + *p++ += c; } return make_string_from_bytes (buf, n, p - buf);