actually fix nil checks
This commit is contained in:
parent
8cb9e30a1d
commit
45a9b539ff
6
util.d
6
util.d
@ -406,7 +406,7 @@ Push(K, V)(HashTable!(K, V)* ht, K key, V value)
|
||||
|
||||
N* node = ht.nil;
|
||||
|
||||
if (CheckNil(ht.nil, ht.free_lists.first))
|
||||
if (!CheckNil(ht.nil, ht.free_lists.first))
|
||||
{
|
||||
node = SLLPop(&ht.free_lists, ht.nil);
|
||||
}
|
||||
@ -432,7 +432,7 @@ Search(K, V)(HashTable!(K, V)* ht, K key)
|
||||
KVPair!(K, V)* result = null;
|
||||
|
||||
auto list = GetList(ht, key);
|
||||
for(auto node = list.first; CheckNil(ht.nil, node); node = node.next)
|
||||
for(auto node = list.first; !CheckNil(ht.nil, node); node = node.next)
|
||||
{
|
||||
if (node.value.key == key)
|
||||
{
|
||||
@ -459,7 +459,7 @@ Delete(K, V)(HashTable!(K, V)* ht, K key)
|
||||
|
||||
auto list = GetList(ht, key);
|
||||
auto prev = ht.nil;
|
||||
for(auto node = list.first; CheckNil(ht.nil, node); node = node.next)
|
||||
for(auto node = list.first; !CheckNil(ht.nil, node); node = node.next)
|
||||
{
|
||||
if (node.value.key == key)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user