}
}
-static void dump_array(struct sorthash_t *obarray,
- int hashcount,
- linenum_t (*fn)(linenum_t))
+void dump_array(const char *legend,
+ struct sorthash_t *obarray, int hashcount)
/* dump the contents of a sort_hash array */
{
struct sorthash_t *np;
+ fputs(legend, stderr);
for (np = obarray; np < obarray + hashcount; np++)
{
struct hash_t scratch;
scratch = np->hash;
- if (fn)
- {
- scratch.start = fn(np->hash.start);
- scratch.end = fn(np->hash.end);
- }
printf("%d: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x %s:%d:%d\n",
np-obarray,
scratch.hash[0],
if (!compile_only)
{
if (debug)
- {
- printf("Consolidated hash list:\n");
- dump_array(sort_buffer, sort_count, NULL);
- }
+ dump_array("Consolidated hash list:\n", sort_buffer, sort_count);
/* now we're ready to emit the report */
puts("#SCF-B 1.1");
report_time("Hash merge done, %d shreds", sort_count);
sort_hashes(sort_buffer, sort_count);
report_time("Sort done");
-
- if (debug)
- {
- puts("Chunk list before reduction.");
- dump_array(sort_buffer, sort_count, NULL);
- }
-
emit_report(sort_buffer, sort_count);
}
unsigned int nonuniques, nreduced, progress, hashcount = *hashcountp;
struct sorthash_t *mp, *np;
+ if (debug)
+ dump_array("Chunk list before reduction.\n",obarray, hashcount);
+
/*
* To reduce the size of the in-core working set, we do a a
* pre-elimination of duplicates based on hash key alone, in
obarray = (struct sorthash_t *)realloc(obarray,
sizeof(struct sorthash_t)* hashcount);
+ if (debug)
+ dump_array("Chunk list after reduction.\n",obarray, hashcount);
+
/* build list of hashes with more than one range associated */
nonuniques = progress = 0;
fprintf(stderr, "%% Extracting duplicates... ");
int mergecount;
hitlist = reduce_matches(obarray, &hashcount);
+ if (debug)
+ dump_array("After removing uniques.\n", obarray, hashcount);
report_time("%d range groups after removing unique hashes", hashcount);
mergecount = collapse_ranges(hitlist, hashcount);
report_time("%d range groups after merging", mergecount);
/* main.c functions */
extern void report_time(char *legend, ...);
extern void corehook(struct hash_t hash, const char *file);
+extern void dump_array(const char *legend,
+ struct sorthash_t *obarray, int hashcount);
/* shredtree.c functions */
extern char **sorted_file_list(const char *, int *);