chiark / gitweb /
Fix notice_processed_counts to use *counts not ipf->counts
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 29 May 2010 17:07:20 +0000 (18:07 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 29 May 2010 17:07:20 +0000 (18:07 +0100)
statemc.c

index 78912e7..dea31a9 100644 (file)
--- a/statemc.c
+++ b/statemc.c
@@ -219,19 +219,21 @@ static int inputfile_is_done(InputFile *ipf) {
 }
 
 static void notice_processed_counts(Counts *counts, int completed,
-                                   InputFile *ipf, const char *what) {
+                                   InputFile *ipf_xtra, const char *what) {
 
 #define RCI_NOTHING(x) /* nothing */
 #define RCI_TRIPLE_FMT(x) " " #x "=" RCI_TRIPLE_FMT_BASE
-#define RCI_TRIPLE_VALS(x) ,RCI_TRIPLE_VALS_BASE(ipf->counts.results, [RC_##x])
+#define RCI_TRIPLE_VALS(x) , RCI_TRIPLE_VALS_BASE(counts->results, [RC_##x])
 
-#define CNT(art,rc) (ipf->counts.results[art_##art][RC_##rc])
+#define CNT(art,rc) (counts->results[art_##art][RC_##rc])
+
+  assert(!completed || ipf_xtra);
 
   char *inprog= completed
     ? xasprintf("%s","") /* GCC produces a stupid warning for printf("") ! */
-    : xasprintf(" inprogress=%ld", ipf->inprogress);
-  char *autodefer= ipf && ipf->autodefer >= 0
-    ? xasprintf(" autodeferred=%ld", ipf->autodefer)
+    : xasprintf(" inprogress=%ld", ipf_xtra->inprogress);
+  char *autodefer= ipf_xtra && ipf_xtra->autodefer >= 0
+    ? xasprintf(" autodeferred=%ld", ipf_xtra->autodefer)
     : xasprintf("%s","");
 
   info("%s %s read=%d (+bl=%d,+err=%d)%s%s"
@@ -239,9 +241,9 @@ static void notice_processed_counts(Counts *counts, int completed,
        RESULT_COUNTS(RCI_NOTHING, RCI_TRIPLE_FMT)
        ,
        completed?"completed":"processed", what,
-       ipf->counts.events[read_ok], ipf->counts.events[read_blank],
-         ipf->counts.events[read_err],
-       inprog, autodefer, ipf->counts.events[nooffer_missing],
+       counts->events[read_ok], counts->events[read_blank],
+         counts->events[read_err],
+       inprog, autodefer, counts->events[nooffer_missing],
        CNT(Unchecked,sent) + CNT(Unsolicited,sent)
        , CNT(Unchecked,sent), CNT(Unsolicited,sent),
        CNT(Wanted,accepted) + CNT(Unsolicited,accepted)
@@ -249,7 +251,7 @@ static void notice_processed_counts(Counts *counts, int completed,
        RESULT_COUNTS(RCI_NOTHING,  RCI_TRIPLE_VALS)
        );
 
-  memset(&ipf->counts, 0, sizeof(ipf->counts));
+  memset(&counts, 0, sizeof(*counts));
 
   free(inprog);
   free(autodefer);