X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fseq_list.c;h=3606f6f399add19e0098d79a85dd046305cccb77;hp=87c5d04f190c1c9d58c8e47b6aa2783fa2efcda6;hb=d4bcca1aa235370bc20bc2734c0cd6f700b17871;hpb=ced6090a330d3d83d0bce709f756aa3d7d65fea4 diff --git a/sbr/seq_list.c b/sbr/seq_list.c index 87c5d04..3606f6f 100644 --- a/sbr/seq_list.c +++ b/sbr/seq_list.c @@ -27,16 +27,16 @@ seq_list(struct msgs *mp, char *seqname) /* On first invocation, allocate initial buffer space */ if (!buffer) { len = MAXBUFFER; - buffer = mh_xmalloc ((size_t) len); + buffer = mh_xcalloc(len, sizeof(char)); } /* - ** Special processing for "cur" sequence. We assume that the - ** "cur" sequence and mp->curmsg are in sync (see seq_add.c). + ** Special processing for the cur sequence. We assume that the + ** cur sequence and mp->curmsg are in sync (see seq_add.c). ** This is returned, even if message doesn't exist or the ** folder is empty. */ - if (!strcmp (current, seqname)) { + if (strcmp(seq_cur, seqname)==0) { if (mp->curmsg) { sprintf(buffer, "%s", m_name(mp->curmsg)); return (buffer); @@ -49,7 +49,7 @@ seq_list(struct msgs *mp, char *seqname) return NULL; /* Get the index of the sequence */ - if ((seqnum = seq_getnum (mp, seqname)) == -1) + if ((seqnum = seq_getnum(mp, seqname)) == -1) return NULL; bp = buffer; @@ -72,7 +72,7 @@ seq_list(struct msgs *mp, char *seqname) char *newbuf; len += MAXBUFFER; - newbuf = mh_xrealloc (buffer, (size_t) len); + newbuf = mh_xrealloc(buffer, len); bp = newbuf + (bp - buffer); buffer = newbuf; } @@ -91,8 +91,8 @@ seq_list(struct msgs *mp, char *seqname) /* ** 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) {