/* On first invocation, allocate initial buffer space */
if (!buffer) {
len = MAXBUFFER;
- buffer = mh_xmalloc((size_t) len);
+ buffer = mh_xcalloc(len, sizeof(char));
}
/*
** This is returned, even if message doesn't exist or the
** folder is empty.
*/
- if (!strcmp(seq_cur, seqname)) {
+ if (strcmp(seq_cur, seqname)==0) {
if (mp->curmsg) {
sprintf(buffer, "%s", m_name(mp->curmsg));
return (buffer);
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->hghmsg && does_exist(mp, i) &&
+ in_sequence(mp, seqnum, i); ++i)
;
if (i - j > 1) {