/* On first invocation, allocate initial buffer space */
if (!buffer) {
len = MAXBUFFER;
- buffer = mh_xmalloc((size_t) len);
+ buffer = mh_xcalloc(len, sizeof(char));
}
/*
bp = buffer;
- for (i = mp->lowmsg; i <= mp->hghmsg; ++i) {
- /*
- ** If message doesn't exist, or isn't in
- ** the sequence, then continue.
- */
- if (!does_exist(mp, i) || !in_sequence(mp, seqnum, i))
+ for (i = mp->lowoff; i <= mp->hghoff; ++i) {
+ /* If message isn't in the sequence, then continue */
+ if (!in_sequence(mp, seqnum, i))
continue;
/*
char *newbuf;
len += MAXBUFFER;
- newbuf = mh_xrealloc(buffer, (size_t) len);
+ newbuf = mh_xrealloc(buffer, len);
bp = newbuf + (bp - buffer);
buffer = newbuf;
}
/*
** Scan to the end of this message range
*/
- for (++i; i <= mp->hghmsg && does_exist(mp, i) && in_sequence(mp, seqnum, i);
- ++i)
+ for (++i; i <= mp->hghoff && in_sequence(mp, seqnum, i); ++i)
;
if (i - j > 1) {