fix hte_same_length()
This commit is contained in:
parent
167e187151
commit
3ad4c51070
1 changed files with 5 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue