emacs-devel
[Top][All Lists]
Advanced

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

Re: struct.el -- a package to encode/decode binary data


From: Stefan Monnier
Subject: Re: struct.el -- a package to encode/decode binary data
Date: Thu, 21 Mar 2002 20:27:47 -0500

> "Stefan Monnier" <monnier+gnu/address@hidden> writes:
> > But now that I think about it, if 160-255 can be an eight-bit-graphic
> > character, how does the code does with "backward-char" ?
> > Looking at DEC_POS in charset.h I see that we do
> 
> >     while (p > p_min && !CHAR_HEAD_P (*p)) p--;
> 
> Please don't skip the following four lines:
> 
>       len = pend + 1 - p;                                             \
>       PARSE_MULTIBYTE_SEQ (p, len, bytes);                            \
>       if (bytes == len)                                               \
>         pos_byte -= len - 1;                                          \
> 
> which handles the above case.  When we at last reach a
> char-head, PARSE_MULTIBYTE_SEQ checks how long the byte
> sequence should be.  We update pos_byte only if the length
> is the same as what we decreased.

Yes, I saw that, so indeed the code is correct.  But it seems
that going back over the whole buffer (potentially) only
to discover that a single byte was needed is kind of silly.
Hence my suggestion to set p_min to max (p_min, p - MAX_MULTIBYTE_LENGTH)


        Stefan




reply via email to

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