exit(1);
}
- fputs("#SCF-A 1.1\n", ofp);
+ fputs("#SCF-A 2.0\n", ofp);
fputs("Generator-Program: comparator 1.0\n", ofp);
fputs("Hash-Method: MD5\n", ofp);
write_options(buf);
{
struct sorthash_t *np;
- fputs(legend, stderr);
+ fputs(legend, stdout);
for (np = obarray; np < obarray + hashcount; np++)
{
struct hash_t scratch;
dump_array("Consolidated hash list:\n", sort_buffer, sort_count);
/* now we're ready to emit the report */
- puts("#SCF-B 1.1");
+ puts("#SCF-B 2.0");
printf("Hash-Method: %s\n", scflist->hash_method);
puts("Merge-Program: comparator " VERSION);
printf("Normalization: %s\n", scflist->normalization);
* point to the same tree. We'll discard those in the next
* phase. This costs less time than one might think; without it,
* the clique detector in the next phase would have to do an
- * extra HASHCMP per array slot to detect clique boundaries. Net
- * cost of this optimization is thus *one* HASHCMP per entry.
+ * extra SORTHASHCMP per array slot to detect clique boundaries. Net
+ * cost of this optimization is thus *one* SORTHASHCMP per entry.
* The benefit is that it kicks lots of shreds out, reducing the
* total working set at the time we build match lists. The idea
* here is to avoid swapping, because typical data sets are so
*
* The technique: first mark...
*/
- if (HASHCMP(obarray, obarray+1))
+ if (SORTHASHCMP(obarray, obarray+1))
obarray[0].hash.start = UNIQUE_FLAG;
for (np = obarray+1; np < obarray + hashcount-1; np++)
- if (HASHCMP(np, np-1) && HASHCMP(np, np+1))
+ if (SORTHASHCMP(np, np-1) && SORTHASHCMP(np, np+1))
np->hash.start = UNIQUE_FLAG;
- if (HASHCMP(obarray+hashcount-2, obarray+hashcount-1))
+ if (SORTHASHCMP(obarray+hashcount-2, obarray+hashcount-1))
obarray[hashcount-1].hash.start = UNIQUE_FLAG;
/* ...then sweep. */
for (mp = np = obarray; np < obarray + hashcount; np++)
/* count the number of hash matches */
nmatches = 1;
for (mp = np+1; mp < obarray + hashcount; mp++)
- if (HASHCMP(np, mp))
+ if (SORTHASHCMP(np, mp))
break;
else
nmatches++;
linenum_t start, end;
unsigned char hash[HASHSIZE];
};
-#define HASHCMP(s, t) memcmp((s)->hash.hash, (t)->hash.hash, HASHSIZE)
+#define SORTHASHCMP(s, t) memcmp((s)->hash.hash, (t)->hash.hash, HASHSIZE)
struct filehdr_t
{
static int sortchunk(const void *a, const void *b)
/* sort by hash */
{
- int cmp = HASHCMP((struct sorthash_t *)a, (struct sorthash_t *)b);
+ int cmp = SORTHASHCMP((struct sorthash_t *)a, (struct sorthash_t *)b);
/*
* Using the file name as a secondary key implies that, later on when