X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=infile.c;fp=infile.c;h=4e34c626e1a34eb4d7599b8cac7f1c717d3a6d85;hb=62a5c8052810dc6e5716c1e1e3bf63294a350167;hp=7ff6a518573a862d6615a4dafef8deab8dc46c6f;hpb=f040b1fe921a666514b59f0374817832e11bca2d;p=innduct.git diff --git a/infile.c b/infile.c index 7ff6a51..4e34c62 100644 --- a/infile.c +++ b/infile.c @@ -77,11 +77,13 @@ static void *feedfile_got_bad_data(InputFile *ipf, off_t offset, const char *data, const char *how) { warn("corrupted file: %s, offset %lu: %s: in %s", ipf->path, (unsigned long)offset, how, sanitise(data,-1)); - ipf->counts.read_err++; - if (ipf->counts.read_err > max_bad_data_initial + - (ipf->counts.read_ok + ipf->counts.read_blank) / max_bad_data_ratio) + ipf->counts.events[read_err]++; + if (ipf->counts.events[read_err] > max_bad_data_initial + + (ipf->counts.events[read_ok] + ipf->counts.events[read_blank]) + / max_bad_data_ratio) crash("too much garbage in input file! (%d errs, %d ok, %d blank)", - ipf->counts.read_err, ipf->counts.read_ok, ipf->counts.read_blank); + ipf->counts.events[read_err], ipf->counts.events[read_ok], + ipf->counts.events[read_blank]); return OOP_CONTINUE; } @@ -129,7 +131,7 @@ static void *feedfile_got_article(oop_source *lp, oop_read *rd, if (data[0]==' ') { if (strspn(data," ") != recsz) X_BAD_DATA("line partially blanked"); - ipf->counts.read_blank++; + ipf->counts.events[read_blank]++; return OOP_CONTINUE; } @@ -144,7 +146,7 @@ static void *feedfile_got_article(oop_source *lp, oop_read *rd, tokentextbuf[tokenlen]= 0; if (!IsToken(tokentextbuf)) X_BAD_DATA("token wrong syntax"); - ipf->counts.read_ok++; + ipf->counts.events[read_ok]++; art= xmalloc(sizeof(*art) - 1 + midlen + 1); memset(art,0,sizeof(*art));