aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorEli Zaretskii2017-11-04 15:00:25 +0200
committerEli Zaretskii2017-11-04 15:00:25 +0200
commitbd886c6f566cb1e79e388305f8be05e55753b730 (patch)
tree7e5f7161a7f0e6398de42b94b79385d5b183be1a /src/alloc.c
parente973c5f5f43ad4d6c98995eea269509b8a258781 (diff)
downloademacs-bd886c6f566cb1e79e388305f8be05e55753b730.tar.gz
emacs-bd886c6f566cb1e79e388305f8be05e55753b730.zip
Allow 'make-string' callers force creation of multibyte strings
* src/alloc.c (Fmake_string): Accept additional argument MULTIBYTE, and produce a multibyte string if it is non-nil. (make_event_array): * src/lread.c (read0): * src/editfns.c (Ftranslate_region_internal): * src/coding.c (Fdefine_coding_system_internal): * src/cmds.c (internal_self_insert): * src/xdisp.c (build_desired_tool_bar_string) (store_mode_line_string): All C callers changed. * doc/lispref/strings.texi (Creating Strings): Document the new optional argument. * etc/NEWS: Mention the new optional argument. * lisp/ruler-mode.el (ruler-mode-ruler): Call make-string with the 3rd argument non-nil.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 0fc79fe68ac..f479226845a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2298,11 +2298,13 @@ string_overflow (void)
2298 error ("Maximum string size exceeded"); 2298 error ("Maximum string size exceeded");
2299} 2299}
2300 2300
2301DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, 2301DEFUN ("make-string", Fmake_string, Smake_string, 2, 3, 0,
2302 doc: /* Return a newly created string of length LENGTH, with INIT in each element. 2302 doc: /* Return a newly created string of length LENGTH, with INIT in each element.
2303LENGTH must be an integer. 2303LENGTH must be an integer.
2304INIT must be an integer that represents a character. */) 2304INIT must be an integer that represents a character.
2305 (Lisp_Object length, Lisp_Object init) 2305If optional argument MULTIBYTE is non-nil, the result will be
2306a multibyte string even if INIT is an ASCII character. */)
2307 (Lisp_Object length, Lisp_Object init, Lisp_Object multibyte)
2306{ 2308{
2307 register Lisp_Object val; 2309 register Lisp_Object val;
2308 int c; 2310 int c;
@@ -2312,7 +2314,7 @@ INIT must be an integer that represents a character. */)
2312 CHECK_CHARACTER (init); 2314 CHECK_CHARACTER (init);
2313 2315
2314 c = XFASTINT (init); 2316 c = XFASTINT (init);
2315 if (ASCII_CHAR_P (c)) 2317 if (ASCII_CHAR_P (c) && NILP (multibyte))
2316 { 2318 {
2317 nbytes = XINT (length); 2319 nbytes = XINT (length);
2318 val = make_uninit_string (nbytes); 2320 val = make_uninit_string (nbytes);
@@ -3930,7 +3932,7 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args)
3930 { 3932 {
3931 Lisp_Object result; 3933 Lisp_Object result;
3932 3934
3933 result = Fmake_string (make_number (nargs), make_number (0)); 3935 result = Fmake_string (make_number (nargs), make_number (0), Qnil);
3934 for (i = 0; i < nargs; i++) 3936 for (i = 0; i < nargs; i++)
3935 { 3937 {
3936 SSET (result, i, XINT (args[i])); 3938 SSET (result, i, XINT (args[i]));