emacs-devel
[Top][All Lists]
Advanced

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

Re: Questionable code in handling of wordend in the regexp engine in reg


From: Alan Mackenzie
Subject: Re: Questionable code in handling of wordend in the regexp engine in regex-emacs.c
Date: Fri, 1 Mar 2019 16:38:25 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Eli.

On Fri, Mar 01, 2019 at 18:22:39 +0200, Eli Zaretskii wrote:
> > Date: Fri, 1 Mar 2019 14:58:56 +0000
> > Cc: address@hidden, address@hidden
> > From: Alan Mackenzie <address@hidden>

> > > > Thanks, I didn't know that.  Maybe we should put an assert into the 
> > > > code,
> > > > like Stefan suggested.

> > > We could try.

> > How about this, as a first approximation?
> > [...]
> > +      /* Check BYTEPOS was at a character boundary. */
> > +      eassert (best_below_byte == bytepos);

> Actually, what I had in mind was a simple

>   eassert (CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos)));

> right at the beginning of buf_bytepos_to_charpos.  But maybe if you
> explain why you wanted a different assertion, I will change my mind.

I had forgotten that it was possible to determine that a UTF8 byte was
at the start of a character.

I think your version is simpler and better.  Lets use it!

But first, I'll commit the fix to bug #34525, including the problems
with "d - 1".  That will be one fewer spot where that new assertion will
get triggered.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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