From b9acb270011d3d69688bbc2f15aa09c58ede67c5 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 25 Feb 2009 14:23:56 +0100 Subject: Use the buffer pointer as a hash key. Not the address of the local variable holding the buffer pointer. --- src/wsbm_manager.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wsbm_manager.c b/src/wsbm_manager.c index 2d53dbe..e40571d 100644 --- a/src/wsbm_manager.c +++ b/src/wsbm_manager.c @@ -926,13 +926,16 @@ wsbmAddValidateItem(struct _ValidateList *list, void *buf, uint64_t flags, struct _WsbmListHead *l; struct _WsbmListHead *hashHead; uint32_t hash; + uint32_t count = 0; + uint32_t key = (unsigned long) buf; cur = NULL; - hash = wsbmHashFunc((uint8_t *) buf, (sizeof(buf)), list->hashMask); + hash = wsbmHashFunc((uint8_t *) &key, 4, list->hashMask); hashHead = list->hashTable + hash; *newItem = 0; for (l = hashHead->next; l != hashHead; l = l->next) { + count++; node = WSBMLISTENTRY(l, struct _ValidateNode, hashHead); if (node->buf == buf) { @@ -940,6 +943,7 @@ wsbmAddValidateItem(struct _ValidateList *list, void *buf, uint64_t flags, break; } } + if (!cur) { cur = validateListAddNode(list, buf, hash, flags, mask); if (!cur) -- cgit v1.2.3