File json-c-0.9-linkhash.patch of Package json-c

diff -Naur json-c-0.9.old//linkhash.c json-c-0.9//linkhash.c
--- json-c-0.9.old//linkhash.c	2009-12-15 23:53:18.000000000 +0000
+++ json-c-0.9//linkhash.c	2009-12-16 00:40:09.000000000 +0000
@@ -158,13 +158,15 @@
 {
 	unsigned long h = t->hash_fn(k);
 	unsigned long n = h % t->size;
+	int count = 0;
 
 	t->lookups++;
-	while( 1 ) {
+	while( count < t->size ) {
 		if(t->table[n].k == LH_EMPTY) return NULL;
 		if(t->table[n].k != LH_FREED &&
 		   t->equal_fn(t->table[n].k, k)) return &t->table[n];
 		if(++n == t->size) n = 0;
+		count++;
 	}
 	return NULL;
 }
openSUSE Build Service is sponsored by