Commit 5729c92f authored by Kenichi Handa's avatar Kenichi Handa

(Fstring): If all arguments are less than 256, return a unibyte

string.
parent e47a1c33
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment