aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-01-25 21:44:04 +0000
committerGerd Moellmann2000-01-25 21:44:04 +0000
commitd0c037d81d868a35c1c5d0dffefc6324134c7cd3 (patch)
tree64275db79b5100cb25b4d7ef710f69cfd0d633f5 /src
parente12489f9ab542b1c83f7ac9cca05fd21a37d4080 (diff)
downloademacs-d0c037d81d868a35c1c5d0dffefc6324134c7cd3.tar.gz
emacs-d0c037d81d868a35c1c5d0dffefc6324134c7cd3.zip
(Fstring): If there is a multibyte char among
the args, always return a multibyte string.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/charset.c17
2 files changed, 17 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index adcfb0089f9..f3a765f5661 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12000-01-25 Gerd Moellmann <gerd@gnu.org> 12000-01-25 Gerd Moellmann <gerd@gnu.org>
2 2
3 * charset.c (Fstring): If there is a multibyte char among
4 the args, always return a multibyte string.
5
62000-01-25 Gerd Moellmann <gerd@gnu.org>
7
3 * sysdep.c (sys_select): Turn atimers off and on instead of 8 * sysdep.c (sys_select): Turn atimers off and on instead of
4 recording and restoring old alarm handler 9 recording and restoring old alarm handler
5 10
diff --git a/src/charset.c b/src/charset.c
index 104756ded65..eb930ccf074 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1361,19 +1361,26 @@ DEFUN ("string", Fstring, Sstring, 1, MANY, 0,
1361 unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n); 1361 unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n);
1362 unsigned char *p = buf; 1362 unsigned char *p = buf;
1363 Lisp_Object val; 1363 Lisp_Object val;
1364 int c; 1364 int c, multibyte_p = 0;
1365 1365
1366 for (i = 0; i < n; i++) 1366 for (i = 0; i < n; i++)
1367 { 1367 {
1368 if (!INTEGERP (args[i])) 1368 CHECK_NUMBER (args[i], 0);
1369 CHECK_NUMBER (args[i], 0);
1370 c = XINT (args[i]); 1369 c = XINT (args[i]);
1371 p += CHAR_STRING (c, p); 1370 p += CHAR_STRING (c, p);
1371
1372 if (!SINGLE_BYTE_CHAR_P (c))
1373 multibyte_p = 1;
1372 } 1374 }
1373 1375
1374 /* Here, we can't use make_string_from_bytes because of byte 1376 /* Here, we can't use make_string_from_bytes because of byte
1375 combining problem. */ 1377 combining problem. Make a multibyte string if there is any
1376 val = make_string (buf, p - buf); 1378 multibyte character in ARGS to make sure that `(insert 2276)'
1379 returns a multibyte string if running --unibyte. */
1380 if (multibyte_p)
1381 val = make_multibyte_string (buf, n, p - buf);
1382 else
1383 val = make_unibyte_string (buf, p - buf);
1377 return val; 1384 return val;
1378} 1385}
1379 1386