From: markus schnalke Date: Tue, 3 Nov 2015 09:57:07 +0000 (+0100) Subject: Remove dead code: FLDEOF and BODYEOF are never set X-Git-Tag: mmh-0.3~68 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=4dc39c08f07428ff5f39acd7b0ddee30e0a004f6 Remove dead code: FLDEOF and BODYEOF are never set --- diff --git a/h/mh.h b/h/mh.h index f9ed645..33b38ee 100644 --- a/h/mh.h +++ b/h/mh.h @@ -207,9 +207,7 @@ struct msgs { #define FMTERR (-3) /* Message Format error */ #define FLD 0 /* Field returned */ #define FLDPLUS 1 /* Field returned with more to come */ -#define FLDEOF 2 /* Field returned ending at eom */ #define BODY 3 /* Body returned with more to come */ -#define BODYEOF 4 /* Body returned ending at eom */ #define FILEEOF 5 /* Reached end of input file */ extern int msg_count; /* m_getfld() indicators (That's a hack!) */ diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 3539ed4..826cfb3 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -187,8 +187,6 @@ m_getfld(int state, unsigned char *name, unsigned char *buf, } switch (state) { - case FLDEOF: - case BODYEOF: case FLD: if (c == '\n' || c == '-') { /* we hit the header/body separator */ diff --git a/sbr/readconfig.c b/sbr/readconfig.c index cbeb481..bc9329f 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -52,7 +52,6 @@ readconfig(struct node **npp, FILE *ib, char *file, int ctx) ib)) { case FLD: case FLDPLUS: - case FLDEOF: np = (struct node *) mh_xmalloc(sizeof(*np)); *npp = np; *(npp = &np->n_next) = NULL; @@ -81,12 +80,9 @@ readconfig(struct node **npp, FILE *ib, char *file, int ctx) *ps->procnaddr = np->n_field; break; } - if (state == FLDEOF) - break; continue; case BODY: - case BODYEOF: adios(EX_CONFIG, NULL, "no blank lines are permitted in %s", file); diff --git a/sbr/seq_read.c b/sbr/seq_read.c index ff01c42..b932cad 100644 --- a/sbr/seq_read.c +++ b/sbr/seq_read.c @@ -79,7 +79,6 @@ seq_public(struct msgs *mp) fp)) { case FLD: case FLDPLUS: - case FLDEOF: if (state == FLDPLUS) { cp = getcpy(field); while (state == FLDPLUS) { @@ -92,12 +91,9 @@ seq_public(struct msgs *mp) } else { seq_init(mp, getcpy(name), trimcpy(field)); } - if (state == FLDEOF) - break; continue; case BODY: - case BODYEOF: adios(EX_CONFIG, NULL, "no blank lines are permitted in %s", seqfile); /* fall */ diff --git a/uip/distsbr.c b/uip/distsbr.c index a856dc7..d1b9474 100644 --- a/uip/distsbr.c +++ b/uip/distsbr.c @@ -59,7 +59,6 @@ distout(char *drft, char *msgnam, char *backup) ifp)) { case FLD: case FLDPLUS: - case FLDEOF: if (!uprf(name, "resent")) { advise(NULL, "Please re-edit draft to remove the ``%s'' header.", name); goto leave_bad; @@ -75,13 +74,9 @@ distout(char *drft, char *msgnam, char *backup) resent = add(buffer, resent); fputs(buffer, ofp); } - if (state == FLDEOF) { - goto process; - } break; case BODY: - case BODYEOF: for (dp = buffer; *dp; dp++) { if (!isspace(*dp)) { advise(NULL, "Please re-edit draft to consist of headers only."); @@ -176,7 +171,6 @@ ready_msg(char *msgnam) switch (state) { case FLD: case FLDPLUS: - case FLDEOF: if (uprf(name, "resent")) { fprintf(ofp, "Prev-"); } @@ -186,13 +180,9 @@ ready_msg(char *msgnam) sizeof buffer, ifp); fputs(buffer, ofp); } - if (state == FLDEOF) { - goto process; - } break; case BODY: - case BODYEOF: fclose(ofp); cp = m_mktemp2(NULL, "dist", &txtfd, NULL); diff --git a/uip/mhbuild.c b/uip/mhbuild.c index 1fdedb6..01acdb7 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -349,7 +349,6 @@ build_mime(char *infile) switch (state = m_getfld(state, name, buf, sizeof(buf), in)) { case FLD: case FLDPLUS: - case FLDEOF: compnum++; /* abort if draft has Mime-Version header field */ @@ -368,7 +367,7 @@ build_mime(char *infile) while (state == FLDPLUS) state = m_getfld(state, name, buf, sizeof(buf), in); - goto finish_field; + continue; } /* get copies of the buffers */ @@ -385,18 +384,13 @@ build_mime(char *infile) /* Now add the header data to the list */ add_header(ct, np, vp); -finish_field: - /* if this wasn't the last hdr field, then continue */ - if (state != FLDEOF) - continue; - /* else fall... */ + continue; case FILEEOF: adios(EX_CONFIG, NULL, "draft has empty body -- no directives!"); /* NOTREACHED */ case BODY: - case BODYEOF: fseek(in, (long) (-strlen(buf)), SEEK_CUR); break; diff --git a/uip/mhparse.c b/uip/mhparse.c index 2afb03a..4885572 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -253,7 +253,6 @@ get_content(FILE *in, char *file, int toplevel) switch (state = m_getfld(state, name, buf, sizeof(buf), in)) { case FLD: case FLDPLUS: - case FLDEOF: compnum++; /* get copies of the buffers */ @@ -270,15 +269,10 @@ get_content(FILE *in, char *file, int toplevel) /* Now add the header data to the list */ add_header(ct, np, vp); - /* continue, if this isn't the last header field */ - if (state != FLDEOF) { - ct->c_begin = ftell(in) + 1; - continue; - } - /* else fall... */ + ct->c_begin = ftell(in) + 1; + continue; case BODY: - case BODYEOF: ct->c_begin = ftell(in) - strlen(buf); break; diff --git a/uip/new.c b/uip/new.c index 90e2da7..cb16dea 100644 --- a/uip/new.c +++ b/uip/new.c @@ -113,7 +113,6 @@ get_msgnums(char *folder, char *sequences[]) fp)) { case FLD: case FLDPLUS: - case FLDEOF: if (state == FLDPLUS) { cp = getcpy(field); while (state == FLDPLUS) { @@ -155,12 +154,9 @@ get_msgnums(char *folder, char *sequences[]) } } - if (state == FLDEOF) - break; continue; case BODY: - case BODYEOF: adios(EX_DATAERR, NULL, "no blank lines are permitted in %s", seqfile); /* fall */ diff --git a/uip/pick.c b/uip/pick.c index 8ae58a4..984d80b 100644 --- a/uip/pick.c +++ b/uip/pick.c @@ -1252,7 +1252,6 @@ plist for (state = FLD, bp = NULL;;) { switch (state = m_getfld(state, name, buf, sizeof buf, fp)) { case FLD: - case FLDEOF: case FLDPLUS: if (bp != NULL) { free(bp); @@ -1266,11 +1265,9 @@ plist } if (!mh_strcasecmp(name, n->n_datef)) break; - if (state != FLDEOF) - continue; + continue; case BODY: - case BODYEOF: case FILEEOF: case LENERR: case FMTERR: diff --git a/uip/prompter.c b/uip/prompter.c index ae0c0c6..2adbd48 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -141,7 +141,6 @@ main(int argc, char **argv) switch (state = m_getfld(state, name, field, sizeof(field), in)) { case FLD: - case FLDEOF: case FLDPLUS: /* ** Check if the value of field contains @@ -183,18 +182,9 @@ abort: } } - if (state == FLDEOF) { /* moby hack */ - /* draft has no body separator; only headers */ - fprintf(out, "--------\n"); - if (!qbody) - break; - printf("--------\n"); - goto has_no_body; - } continue; case BODY: - case BODYEOF: case FILEEOF: fprintf(out, "--------\n"); if (qbody) { diff --git a/uip/slocal.c b/uip/slocal.c index eac77e4..ca267fa 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -760,7 +760,6 @@ parse(int fd) switch (state = m_getfld(state, name, field, sizeof(field), in)) { case FLD: - case FLDEOF: case FLDPLUS: lp = getcpy(field); while (state == FLDPLUS) { @@ -795,13 +794,9 @@ parse(int fd) p++, i++; p->p_name = NULL; } - if (state != FLDEOF) { - continue; - } - break; + continue; case BODY: - case BODYEOF: case FILEEOF: break; diff --git a/uip/sortm.c b/uip/sortm.c index ae4038d..4ca0c72 100644 --- a/uip/sortm.c +++ b/uip/sortm.c @@ -336,7 +336,6 @@ get_fields(char *datesw, int msg, struct smsg *smsg) for (compnum = 1, state = FLD;;) { switch (state = m_getfld(state, nam, buf, sizeof(buf), in)) { case FLD: - case FLDEOF: case FLDPLUS: compnum++; if (!mh_strcasecmp(nam, datesw)) { @@ -366,7 +365,6 @@ get_fields(char *datesw, int msg, struct smsg *smsg) continue; case BODY: - case BODYEOF: case FILEEOF: break;