diff options
author | Kenichi Handa <handa@m17n.org> | 2001-02-09 05:32:24 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2001-02-09 05:32:24 +0000 |
commit | 5729c92fb2999977fdc2de367def7d847f6d249e (patch) | |
tree | 5e3ab8a1668800253a392bbc2a76b0ad7af031da /src/charset.c | |
parent | e47a1c3370c4537ff4b9970d97d7076d912ccb18 (diff) | |
download | emacs-5729c92fb2999977fdc2de367def7d847f6d249e.tar.gz |
(Fstring): If all arguments are less than 256, return a unibyte
string.
Diffstat (limited to 'src/charset.c')
-rw-r--r-- | src/charset.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/charset.c b/src/charset.c index 4bad7b5ab28..dcdb279b59f 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1619,12 +1619,22 @@ DEFUN ("string", Fstring, Sstring, 1, MANY, 0, 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); |