]> thyrsus.com Git - comparator.git/commitdiff
Serious speedup by collapsing the search loop.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 13 Sep 2003 22:20:57 +0000 (22:20 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 13 Sep 2003 22:20:57 +0000 (22:20 +0000)
report.c

index e211c61d4a9085d339ea4702809b569187acf91d..56a45b8fbbd76c7e375b274f060911d177a898ab 100644 (file)
--- a/report.c
+++ b/report.c
@@ -106,7 +106,7 @@ static int collapse_ranges(struct match_t *reduced, int nonuniques)
     int removed = 0;
 
     /*
-     * For two matches to be eligible for merger, all the filenames
+     * For two matches to be eligible for merger, all their filenames must
      * match pairwise.  If there are no such matches, these chunks are
      * completely irrelevant to each other.  It might be that for some
      * values of i the filenames are equal and for others not.  In
@@ -135,7 +135,7 @@ static int collapse_ranges(struct match_t *reduced, int nonuniques)
 
      /* time to merge overlapping shreds */
      for (sp = reduced; sp < reduced + nonuniques; sp++)
-        for (tp = sp + 1; tp < reduced + nonuniques; tp++)
+        for (tp = sp + 1; !compare_files(sp, tp); tp++)
         {
 #ifdef DEBUG
             printf("Trying merge of %d into %d\n", tp-reduced, sp-reduced);