[Top][All Lists]

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

bug#31837: 26.1; replace-buffer-contents doesn't work if buffer has mult

From: Eli Zaretskii
Subject: bug#31837: 26.1; replace-buffer-contents doesn't work if buffer has multibyte characters
Date: Tue, 19 Jun 2018 05:30:29 +0300

> From: Milan Stanojević <address@hidden>
> Date: Mon, 18 Jun 2018 16:29:41 -0400
> Cc: address@hidden
> If we do care about optimizing it, then it is better to check whether
> the buffer actually contains multibyte characters (I guess with
> BUF_Z(buf) == BUF_Z_BYTE(buf)) than using enable_multibyte_characters
> since the the former would catch strictly more cases when we don't
> need charpos to bytepos conversion.

No, testing BUF_Z vs BUF_Z_BYTE cannot possibly catch more cases,
because multibyte characters cannot happen in a buffer whose
enable_multibyte_characters is reset, and any unibyte buffer's Z value
is trivially equal to its Z_BYTE value.

> Also, it occurs to me, the check shouldn't be done in
> buffer_chars_equal, since the same check would be done multiple times
> for a single character (for every comparison of that character), it
> should be done once and the result stored in ctx before calling
> compareseq.

Something to consider if further optimization is needed.

reply via email to

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