On Sun, Jan 25, 2026 at 02:49:16PM +0100, Alejandro Colomar via Mutt-dev wrote:
> Hi Kevin,
> 
> On Sun, Jan 25, 2026 at 06:30:23PM +0800, Kevin J. McCarthy wrote:
> > When one is missing, include the previous newline as part of the
> > message.
> > 
> > This addresses ticket 415.  It's not a perfect solution, but it stops
> > the problem from propagating into other mbox files.
> > ---
> >  mbox.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/mbox.c b/mbox.c
> > index a2a32d13..2a266da7 100644
> > --- a/mbox.c
> > +++ b/mbox.c
> > @@ -314,7 +314,8 @@ int mbox_parse_mailbox (CONTEXT *ctx)
> >  
> >     if (PREV->content->length < 0)
> >     {
> > -     PREV->content->length = loc - PREV->content->offset - 1;
> > +     PREV->content->length = loc - PREV->content->offset -
> > +                                  (has_mbox_sep ? 1 : 0);
> 
> You may want to simplify as 
> 
>         PREV->content->length = loc - PREV->content->offset - !!has_mbox_sep;

Doing an integer operation on a boolean value is "tricky" for the C
standard from what I recall.  Or I may be totally wrong, but it's tricky
to read and notice what is happening here.

The compiler should generate the same code either way.

Anyway, not a complaint, just a comment for when you have to look at
this line of code in 10 years and remember what it is doing :)

thanks,

greg k-h

Reply via email to