From 390b53590ae82dad40e37ac1b818b948ea032829 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 21 Nov 2011 19:23:42 +0100 Subject: [PATCH] Fix lookup of of hashitem to hashpos: we have to use the indirect position not the index of values array. --- libcitadel/lib/hash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcitadel/lib/hash.c b/libcitadel/lib/hash.c index d315358be..d4c2f5080 100644 --- a/libcitadel/lib/hash.c +++ b/libcitadel/lib/hash.c @@ -622,10 +622,10 @@ void Put(HashList *Hash, const char *HKey, long HKLen, void *Data, DeleteHashDat /** oh, we're brand new... */ if (Hash->LookupTable[HashAt] == NULL) { InsertHashItem(Hash, HashAt, HashBinKey, HKey, HKLen, Data, DeleteIt); - }/** Insert After? */ + }/** Insert Before? */ else if (Hash->LookupTable[HashAt]->Key > HashBinKey) { InsertHashItem(Hash, HashAt, HashBinKey, HKey, HKLen, Data, DeleteIt); - }/** Insert before? */ + }/** Insert After? */ else if (Hash->LookupTable[HashAt]->Key < HashBinKey) { InsertHashItem(Hash, HashAt + 1, HashBinKey, HKey, HKLen, Data, DeleteIt); } @@ -769,7 +769,7 @@ int GetHashPosFromKey(HashList *Hash, const char *HKey, long HKLen, HashPos *At) return 0; } /** GOTCHA! */ - At->Position = Hash->LookupTable[HashAt]->Position; + At->Position = HashAt; return 1; } -- 2.30.2