bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56347: Optimize/simplify STRING_SET_MULTIBYTE


From: Stefan Monnier
Subject: bug#56347: Optimize/simplify STRING_SET_MULTIBYTE
Date: Sat, 02 Jul 2022 12:49:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> --- a/src/composite.c
>> +++ b/src/composite.c
>> @@ -1879,11 +1879,7 @@ Otherwise (for terminal display), FONT-OBJECT must be 
>> a terminal ID, a
>>        for (i = SBYTES (string) - 1; i >= 0; i--)
>>          if (!ASCII_CHAR_P (SREF (string, i)))
>>            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;
>> +      /* STRING is a pure-ASCII string, so we can treat it as multibyte.  */
>
> Did you actually try your change in the situations where this problem
> pops up?  AFAIR, the code makes a copy of the string for good reasons:
> the rest of handling of the string down the line barfs if we keep a
> multibyte string here.

Of course, if we really do need a multibyte copy of the string, I can
change the patch to call `Fstring_to_multibyte` instead of `Fconcat`.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]