diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-07-09 12:53:34 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-07-09 12:53:34 -0400 |
commit | ad011fd3accd97f5ab96dd7459ee8ef9f6ab4090 (patch) | |
tree | 53f7d96b6232158c7eaeab028dc017ac1dc61a71 /src/composite.c | |
parent | 16e79eb75f0d55bc24442f0faf11cd0a4ca8f62c (diff) | |
download | emacs-ad011fd3accd97f5ab96dd7459ee8ef9f6ab4090.tar.gz emacs-ad011fd3accd97f5ab96dd7459ee8ef9f6ab4090.tar.bz2 emacs-ad011fd3accd97f5ab96dd7459ee8ef9f6ab4090.zip |
Make STRING_SET_MULTIBYTE an inline function
* src/lisp.h (STRING_SET_MULTIBYTE): Make it into a function.
* src/composite.c (Fcomposition_get_gstring):
Prefer `make_multibyte_string` over Fconcat+STRING_SET_MULTIBYTE.
Diffstat (limited to 'src/composite.c')
-rw-r--r-- | src/composite.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/composite.c b/src/composite.c index 4d69702171f..552214ae848 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1871,7 +1871,8 @@ should be ignored. */) else { CHECK_STRING (string); - validate_subarray (string, from, to, SCHARS (string), &frompos, &topos); + ptrdiff_t chars = SCHARS (string); + validate_subarray (string, from, to, chars, &frompos, &topos); if (! STRING_MULTIBYTE (string)) { ptrdiff_t i; @@ -1881,9 +1882,10 @@ should be ignored. */) error ("Attempt to shape unibyte text"); /* STRING is a pure-ASCII string, so we can convert it (or, rather, its copy) to multibyte and use that thereafter. */ - Lisp_Object string_copy = Fconcat (1, &string); - STRING_SET_MULTIBYTE (string_copy); - string = string_copy; + /* FIXME: Not clear why we need to do that: AFAICT the rest of + the code should work on an ASCII-only unibyte string just + as well (bug#56347). */ + string = make_multibyte_string (SDATA (string), chars, chars); } frombyte = string_char_to_byte (string, frompos); } |