From e09e68e8a4e4616c3d21fe7cb6687d720d5466f7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 31 Aug 2003 10:20:27 +0000 Subject: [PATCH] Ready for interning. --- report.c | 28 ++++++++++++++++++++++++++++ shred.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/report.c b/report.c index d57bccd..81679d1 100644 --- a/report.c +++ b/report.c @@ -6,6 +6,7 @@ #include #include #include +#include "shred.h" static int local_duplicates; @@ -144,5 +145,32 @@ main(int argc, char *argv[]) /* read in all hashes */ for (sp = shiflist; sp < shiflist + filecount; sp++) { + u_int32_t sectcount; + + fread(§count, sizeof(u_int32_t), 1, sp->fp); + sectcount = ntohl(sectcount); + while (sectcount--) + { + char buf[BUFSIZ]; + linenum_t chunks; + + fgets(buf, sizeof(buf), sp->fp); + file_intern(buf); + fread(&chunks, sizeof(linenum_t), 1, sp->fp); + chunks = FROMNET(chunks); + + while (chunks--) + { + struct hash_t this; + + fread(&this, sizeof(struct hash_t), 1, sp->fp); + this.start = FROMNET(this.start); + this.end = FROMNET(this.end); + hash_intern(&this); + } + } } + report_time("Hash merge done."); + + /* more... */ } diff --git a/shred.h b/shred.h index b845389..bd27cc8 100644 --- a/shred.h +++ b/shred.h @@ -21,4 +21,8 @@ struct hash_t char hash[HASHSIZE]; }; +/* hashmap.c */ +void file_intern(const char *); +void hash_intern(const struct hash_t *); + /* shred.h ends here */ -- 2.43.0