X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fseq_read.c;h=4cc42233c2629b70d9b10a5ec83cb8d293b7bb0c;hp=1929b263f8400d392c4f93ee78b07e2861b57c1e;hb=a4ff68e851c0931ced437f73a1acb0fedb28bec3;hpb=1e99819ed105950cd584c71fa4b2e36b038be102 diff --git a/sbr/seq_read.c b/sbr/seq_read.c index 1929b26..4cc4223 100644 --- a/sbr/seq_read.c +++ b/sbr/seq_read.c @@ -32,7 +32,7 @@ seq_read(struct msgs *mp) ** Initialize the list of sequence names. Go ahead and ** add the cur sequence to the list of sequences. */ - mp->msgattrs[0] = getcpy(seq_cur); + mp->msgattrs[0] = mh_xstrdup(seq_cur); mp->msgattrs[1] = NULL; make_all_public(mp); /* initially, make all public */ @@ -76,8 +76,11 @@ seq_public(struct msgs *mp) /* Use m_getfld to scan sequence file */ for (state = FLD2;;) { switch (state = m_getfld2(state, &f, fp)) { + case LENERR2: + state = FLD2; + /* FALL */ case FLD2: - seq_init(mp, getcpy(f.name), trimcpy(f.value)); + seq_init(mp, mh_xstrdup(f.name), trimcpy(f.value)); continue; case BODY2: @@ -120,9 +123,9 @@ seq_private(struct msgs *mp) (j = strlen(np->n_name) - plen) > alen && *(np->n_name + j) == '-' && strcmp(mp->foldpath, np->n_name + j + 1)==0) { - cp = getcpy(np->n_name + alen); + cp = mh_xstrdup(np->n_name + alen); *(cp + j - alen) = '\0'; - if ((i = seq_init(mp, cp, getcpy(np->n_field))) != -1) + if ((i = seq_init(mp, cp, mh_xstrdup(np->n_field))) != -1) make_seq_private(mp, i); } } @@ -168,8 +171,8 @@ seq_init(struct msgs *mp, char *name, char *field) /* Return error, if too many sequences */ if (i >= NUMATTRS) { - free(name); - free(field); + mh_free0(&name); + mh_free0(&field); return -1; } @@ -178,7 +181,7 @@ seq_init(struct msgs *mp, char *name, char *field) ** name string. Else add it to the list of sequence names. */ if (mp->msgattrs[i]) { - free(name); + mh_free0(&name); } else { mp->msgattrs[i] = name; mp->msgattrs[i + 1] = NULL; @@ -207,14 +210,19 @@ seq_init(struct msgs *mp, char *name, char *field) ** We iterate through messages in this range ** and flip on bit for this sequence. */ + if (k > mp->hghoff) { + if (!(mp = folder_realloc(mp, mp->lowoff, k))) { + adios(EX_OSERR, NULL, "unable to allocate folder storage"); + } + mp->hghoff = k; + } for (; j <= k; j++) { - if (j >= mp->lowmsg && j <= mp->hghmsg && - does_exist(mp, j)) + if (j >= mp->lowmsg && j <= mp->hghoff) add_sequence(mp, i, j); } } } - free(field); /* free string containing message ranges */ + mh_free0(&field); /* free string containing message ranges */ return i; }