r3697 - branches/2.0/varnish-cache/bin/varnishd
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Mon Feb 9 13:13:38 CET 2009
Author: tfheen
Date: 2009-02-09 13:13:38 +0100 (Mon, 09 Feb 2009)
New Revision: 3697
Modified:
branches/2.0/varnish-cache/bin/varnishd/cache_hash.c
branches/2.0/varnish-cache/bin/varnishd/hash_classic.c
branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c
branches/2.0/varnish-cache/bin/varnishd/hash_slinger.h
Log:
Merge r3507: Ditch HSH_Compare() and just check the digest with memcmp()
Modified: branches/2.0/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_hash.c 2009-02-09 12:10:36 UTC (rev 3696)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_hash.c 2009-02-09 12:13:38 UTC (rev 3697)
@@ -143,36 +143,6 @@
}
}
-int
-HSH_Compare(const struct sess *sp, const struct objhead *oh)
-{
- int i;
- unsigned u, v;
- const char *b;
-
- CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
- CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
- i = sp->lhashptr - oh->hashlen;
- if (i)
- return (i);
- b = oh->hash;
- for (u = 0; u < sp->ihashptr; u += 2) {
- v = pdiff(sp->hashptr[u], sp->hashptr[u + 1]);
- i = memcmp(sp->hashptr[u], b, v);
- if (i)
- return (i);
- b += v;
- i = '#' - *b++;
- if (i)
- return (i);
- }
- assert(*b == '\0');
- b++;
- assert(b == oh->hash + oh->hashlen);
- return (0);
-}
-
void
HSH_Copy(const struct sess *sp, struct objhead *oh)
{
Modified: branches/2.0/varnish-cache/bin/varnishd/hash_classic.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/hash_classic.c 2009-02-09 12:10:36 UTC (rev 3696)
+++ branches/2.0/varnish-cache/bin/varnishd/hash_classic.c 2009-02-09 12:13:38 UTC (rev 3697)
@@ -132,15 +132,7 @@
Lck_Lock(&hp->mtx);
VTAILQ_FOREACH(oh, &hp->head, hoh_list) {
- if (sp->lhashptr < oh->hashlen)
- continue;
- if (sp->lhashptr > oh->hashlen)
- break;
- if (oh->hoh_digest < digest)
- continue;
- if (oh->hoh_digest > digest)
- break;
- i = HSH_Compare(sp, oh);
+ i = memcmp(oh->digest, noh->digest, sizeof oh->digest);
if (i < 0)
continue;
if (i > 0)
Modified: branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c 2009-02-09 12:10:36 UTC (rev 3696)
+++ branches/2.0/varnish-cache/bin/varnishd/hash_simple_list.c 2009-02-09 12:13:38 UTC (rev 3697)
@@ -75,7 +75,7 @@
CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC);
Lck_Lock(&hsl_mtx);
VTAILQ_FOREACH(oh, &hsl_head, hoh_list) {
- i = HSH_Compare(sp, oh);
+ i = memcmp(oh->digest, noh->digest, sizeof oh->digest);
if (i < 0)
continue;
if (i > 0)
Modified: branches/2.0/varnish-cache/bin/varnishd/hash_slinger.h
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/hash_slinger.h 2009-02-09 12:10:36 UTC (rev 3696)
+++ branches/2.0/varnish-cache/bin/varnishd/hash_slinger.h 2009-02-09 12:13:38 UTC (rev 3697)
@@ -51,7 +51,6 @@
/* cache_hash.c */
void HSH_Prealloc(struct sess *sp);
void HSH_Freestore(struct object *o);
-int HSH_Compare(const struct sess *sp, const struct objhead *o);
void HSH_Copy(const struct sess *sp, struct objhead *o);
struct object *HSH_Lookup(struct sess *sp);
void HSH_Unbusy(const struct sess *sp);
More information about the varnish-commit
mailing list