Author: allthecoolkidshaveone <allthecoolkidshaveone@
ba372814-4f39-11de-9ad6-
1127a62b9fcd>
Date: Wed Jan 13 09:36:05 2010 +0000
Issue 88: Possible fix for the hash table crash bug.
Fixes #235
keycopy = mush_strdup(key, "hash.key");
- if (!hash_insert(htab, keycopy, hashdata)) {
- first_offset = -1;
- resize_calls = 0;
- if (!real_hash_resize(htab, htab->hashsize,
- (htab->hashfunc_offset + 1) % NHASH_MOD)) {
- htab->entries -= 1;
- return false;
- }
+
+ while (1) {
+ if (!hash_insert(htab, keycopy, hashdata)) {
+ first_offset = -1;
+ resize_calls = 0;
+ if (!real_hash_resize(htab, htab->hashsize,
+ (htab->hashfunc_offset + 1) % NHASH_MOD)) {
+ htab->entries -= 1;
+ return false;
+ }
+ } else
+ break;
}
return true;
}