nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] packf: change of cur

2010-11-09 15:42:00
markus schnalke wrote:
I read through uip/packf.c and came across this:

  177      if (mp->hghsel != mp->curmsg)
  178          seq_setcur (mp, mp->lowsel);

This sets the current message to the first message selected, unless
the last message was the current. This special case is not documented
in the man page.

What's the reason for this special case? I'd rather remove it than
update the documentation.

I don't know, but cvs annotate says it's been that way for over
a decade :-)   My guess is that it was an attempt to avoid the
overhead of setting the current message if it was already what
we wanted to set it to, but with an inadvertent error.
(Compare the code in uip/burst.c.)

However, if it's reasonable to avoid the overhead, we ought to do
it with a check in seq_setcur() where all callers can benefit from
it. So I think my choice would be to add a check to seq_setcur():
    if (mp->curmsg == msgnum)
        return;

and then remove this if () from packf.c, unless anybody can come
up with a justification for it that I'm not seeing.

-- PMM

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>