]> thyrsus.com Git - comparator.git/commitdiff
Report correctly.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 12 Sep 2003 01:44:40 +0000 (01:44 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 12 Sep 2003 01:44:40 +0000 (01:44 +0000)
report.c

index 64159c5ea2bbbf94fc891e9ad991ea8f7722b68c..f67c1b580204f0bf223f6a384c740b567c402ab8 100644 (file)
--- a/report.c
+++ b/report.c
@@ -99,10 +99,11 @@ static int sametree(const char *s, const char *t)
     return (sn == tn) && !strncmp(s, t, sn); 
 }
 
-static void collapse_ranges(struct match_t *reduced, int *nonuniques)
+static int collapse_ranges(struct match_t *reduced, int nonuniques)
 /* collapse together overlapping ranges in the hit list */
 { 
     struct match_t *sp, *tp;
+    int removed = 0;
 
 #ifdef DEBUG
      for (sp = reduced; sp->next; sp = sp->next)
@@ -153,10 +154,12 @@ static void collapse_ranges(struct match_t *reduced, int *nonuniques)
                     printf("%s:%d:%d\n",  rp->file, rp->start, rp->end);
 #endif /* DEBUG */
                 free(tp->matches);
-                (*nonuniques)--;
+                nonuniques--;
                 tp->matches = NULL;
             }
         }
+
+     return(nonuniques);
 }
 
 struct match_t *reduce_matches(struct sorthash_t *obarray, int *hashcountp)
@@ -259,7 +262,7 @@ struct match_t *reduce_matches(struct sorthash_t *obarray, int *hashcountp)
 
      report_time("%d range groups after removing unique hashes", nonuniques);
 
-     *hashcountp = hashcount;
+     *hashcountp = nonuniques;
      return reduced;
 }
 
@@ -285,7 +288,7 @@ void emit_report(struct sorthash_t *obarray, int hashcount)
     int i, matchcount;
 
     hitlist = reduce_matches(obarray, &hashcount);
-    collapse_ranges(hitlist, &hashcount);
+    hashcount = collapse_ranges(hitlist, hashcount);
     report_time("%d range groups after merging", hashcount);
     report_time("Reduction done");