From 3ad4c5107099ec6c49ee861d16865fc2ce21de3e Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Fri, 7 Jun 2013 13:46:16 +0200
Subject: [PATCH] fix hte_same_length()

---
 src/datastructures.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/datastructures.c b/src/datastructures.c
index 730c6b99..55b8345e 100644
--- a/src/datastructures.c
+++ b/src/datastructures.c
@@ -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
 }
-- 
GitLab