]> thyrsus.com Git - comparator.git/commitdiff
Ready for interning.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 31 Aug 2003 10:20:27 +0000 (10:20 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 31 Aug 2003 10:20:27 +0000 (10:20 +0000)
report.c
shred.h

index d57bccd019bd404b60e17764eece036f1cbd2c87..81679d146f6637d940b8921f9aaf95f585faa47c 100644 (file)
--- a/report.c
+++ b/report.c
@@ -6,6 +6,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#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(&sectcount, 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 b84538959c52f305ec18ffdb92d939bd623ed028..bd27cc885550bf7dd2d91dda99c9bc51a358e317 100644 (file)
--- 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 */