]> err.no Git - varnish/commitdiff
Add piecemal crc32 function back, we will need it for the scatter/gather
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 6 Aug 2007 09:19:20 +0000 (09:19 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 6 Aug 2007 09:19:20 +0000 (09:19 +0000)
hash string.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1804 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/include/libvarnish.h
varnish-cache/lib/libvarnish/crc32.c

index 7022d3e4620a71eb7b56db46229a85f44d148029..6bac9eb9d286f22fe54cc469e1ce2a9c5378f8a3 100644 (file)
@@ -42,6 +42,7 @@ void FreeArgv(char **argv);
 char **ParseArgv(const char *s, int comment);
 
 /* from libvarnish/crc32.c */
+uint32_t crc32(uint32_t crc, const void *p1, unsigned l);
 uint32_t crc32_l(const void *p1, unsigned l);
 
 /* from libvarnish/time.c */
index c63cab620a1bcdc9a7e49e2b0ab437b9191aa9c3..8ea4255349ce9df4cfad48b7c89c143c4e2b29b2 100644 (file)
@@ -82,14 +82,21 @@ static uint32_t crc32bits[] = {
 };
 
 uint32_t
-crc32_l(const void *p1, unsigned l)
+crc32(uint32_t crc, const void *p1, unsigned l)
 {
        const unsigned char *p;
-       uint32_t crc;
-
-       crc = ~0U;
 
        for (p = (const unsigned char*)p1; l-- > 0; p++)
                crc = (crc >> 8) ^ crc32bits[(crc ^ *p) & 0xff];
+       return (crc);
+}
+
+uint32_t
+crc32_l(const void *p1, unsigned l)
+{
+       uint32_t crc;
+
+       crc = crc32(~0U, p1, l);
        return (crc ^ ~0U);
 }
+