fix hte_same_length()

This commit is contained in:
Sven M. Hallberg 2013-06-07 13:46:16 +02:00
parent 167e187151
commit 3ad4c51070

View file

@ -276,10 +276,12 @@ void h_hashtable_free(HHashTable* ht) {
// helper for hte_equal
static bool hte_same_length(HHashTableEntry *xs, HHashTableEntry *ys) {
for(; xs && ys; xs=xs->next, ys=ys->next) {
while(xs && ys) {
xs=xs->next;
ys=ys->next;
// skip NULL keys (= element not present)
if(xs->key == NULL) xs=xs->next;
if(ys->key == NULL) ys=ys->next;
while(xs && xs->key == NULL) xs=xs->next;
while(ys && ys->key == NULL) ys=ys->next;
}
return (xs == ys); // both NULL
}