Subject: Re: bug#24378: [PATCH 1/6] Don’t use FETCH_MULTIBYTE_CHAR when advancing index

From: Eli Zaretskii <[email-masked]>
Date: Tue, 06 Sep 2016 18:27:31 +0300

> From: Michal Nazarewicz <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 06 Sep 2016 17:17:30 +0200
> 
> On Tue, Sep 06 2016, Eli Zaretskii wrote:
> >> From: Michal Nazarewicz <[email-masked]>
> >> Date: Tue,  6 Sep 2016 15:31:29 +0200
> >> 
> >> * src/casefiddle.c (casify_region): use STRING_CHAR_AND_LENGTH as a safe
> >> alternative to FETCH_MULTIBYTE_CHAR which is documented in src/buffer.h
> >> as unsafe when used for advancing index.
> >
> > AFAIK, that comment is stale and no longer correct.  I don't think
> > there's a reason to make this change anymore, since STRING_CHAR no
> > longer unifies characters.
> 
> I’ll drop the patch in favour of updating the comment in
> FETCH_MULTIBYTE_CHAR then.

Thanks.  While you are at that, please also update a similar comment
for STRING_CHAR as well.

> /me wonders if STRING_CHAR_AND_LENGTH must be faster than
> FETCH_MULTIBYTE_CHAR followed by CHAR_BYTES.

It might or might not be faster (measurements are welcome), but
FETCH_MULTIBYTE_CHAR is safer when the code could GC, because it uses
a byte position, not a C pointer to buffer text.