]> arthur.barton.de Git - bup.git/commitdiff
Remove old hashsplit.c, since hashsplit.py replaces it.
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 30 Dec 2009 21:10:21 +0000 (16:10 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 30 Dec 2009 21:10:21 +0000 (16:10 -0500)
Makefile
hashsplit.c [deleted file]

index b2189bcd3e4a682c1fb3962c0ae21c493a8c6d48..a26c421ce6d70c3eb090472f7c59f4b9b8e79f5c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,12 +4,8 @@ default: all
 
 all: hashsplit hashjoin datagen hashsplit.so
 
-hashsplit: hashsplit.o
-
 datagen: datagen.o
 
-hashjoin: hashjoin.sh
-
 hashsplit.so: hashsplitmodule.o
        $(CC) -shared -Wl,-Bsymbolic-functions -o $@ $<
 
@@ -27,6 +23,10 @@ test: all
 %: %.o
        gcc -o $@ $< $(LDFLAGS) $(LIBS)
        
+%: %.py
+       rm -f $@
+       ln -s $^ $@
+       
 %: %.sh
        rm -f $@
        ln -s $^ $@
diff --git a/hashsplit.c b/hashsplit.c
deleted file mode 100644 (file)
index 038f2d0..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdio.h>
-#include <stdint.h>
-#include <assert.h>
-#include <memory.h>
-
-#define BLOBBITS (14)
-#define BLOBSIZE (1<<(BLOBBITS-1))
-#define WINDOWBITS (7)
-#define WINDOWSIZE (1<<(WINDOWBITS-1))
-
-
-// FIXME: replace this with a not-stupid rolling checksum algorithm,
-// such as the one used in rsync (Adler32?)
-static uint32_t stupidsum_add(uint32_t old, uint8_t drop, uint8_t add)
-{
-    return ((old<<1) | (old>>31)) ^ drop ^ add;
-}
-
-
-static void test_sums()
-{
-    uint32_t sum = 0;
-    int i;
-    
-    for (i = 0; i < WINDOWSIZE; i++)
-       sum = stupidsum_add(sum, 0, i%256);
-    uint32_t sum1 = sum;
-    
-    for (i = 0; i < WINDOWSIZE*2; i++)
-       sum = stupidsum_add(sum, i%256, i%256);
-    assert(sum1 == sum);
-    
-    for (i = 0; i < WINDOWSIZE; i++)
-       sum = stupidsum_add(sum, i%256, 0);
-    assert(sum == 0);
-}
-
-
-int main()
-{
-    assert(WINDOWSIZE >= 32);
-    assert(BLOBSIZE >= 32);
-    test_sums();
-    
-    uint8_t buf[WINDOWSIZE];
-    uint32_t sum = 0;
-    int i = 0, count = 0, last_count = 0, c;
-    FILE *pipe = NULL;
-    
-    memset(buf, 0, sizeof(buf));
-    
-    // FIXME: read more than one byte at a time.  This is absurdly slow.
-    while ((c = fgetc(stdin)) != EOF)
-    {
-       sum = stupidsum_add(sum, buf[i], c);
-       buf[i] = c;
-       
-       if (0)
-       {
-           int j;
-           fprintf(stderr, "[%5X] %08X  '", i, sum);
-           for (j = i+1; j < i+1+WINDOWSIZE; j++)
-           {
-               int d = buf[j % WINDOWSIZE];
-               fputc((d >= 32 && d <= 126) ? d : '.', stderr);
-           }
-           fprintf(stderr, "'\n");
-       }
-       
-       i = (i + 1) % WINDOWSIZE;
-       count++;
-       
-       if (!pipe)
-           pipe = popen("git hash-object --stdin -w", "w");
-           
-        // FIXME: write more than one byte at a time.  This is absurdly
-        // slow.
-       fputc(c, pipe);
-       
-       if ((sum & (BLOBSIZE-1)) == ((~0) & (BLOBSIZE-1)))
-       {
-           fprintf(stderr, "SPLIT @ %-8d size=%-8d (%d/%d)\n",
-                   count, count - last_count, BLOBSIZE, WINDOWSIZE);
-           last_count = count;
-           i = 0;
-           memset(buf, 0, sizeof(buf));
-           sum = 0;
-           if (pipe)
-           {
-               fflush(stderr);
-               pclose(pipe);
-               pipe = NULL;
-           }
-       }
-    }
-    
-    if (pipe)
-       pclose(pipe);
-    
-    return 0;
-}