|
@@ -43,8 +43,9 @@ static unsigned int tdb_hash(const char *name)
|
|
unsigned i; /* Used to cycle through random values. */
|
|
unsigned i; /* Used to cycle through random values. */
|
|
|
|
|
|
/* Set the initial value from the key size. */
|
|
/* Set the initial value from the key size. */
|
|
- for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++)
|
|
|
|
|
|
+ for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++) {
|
|
value = (value + (((const unsigned char *)name)[i] << (i * 5 % 24)));
|
|
value = (value + (((const unsigned char *)name)[i] << (i * 5 % 24)));
|
|
|
|
+ }
|
|
|
|
|
|
return (1103515243 * value + 12345);
|
|
return (1103515243 * value + 12345);
|
|
}
|
|
}
|
|
@@ -93,8 +94,9 @@ static QDictEntry *qdict_find(const QDict *qdict,
|
|
QDictEntry *entry;
|
|
QDictEntry *entry;
|
|
|
|
|
|
QLIST_FOREACH(entry, &qdict->table[bucket], next)
|
|
QLIST_FOREACH(entry, &qdict->table[bucket], next)
|
|
- if (!strcmp(entry->key, key))
|
|
|
|
|
|
+ if (!strcmp(entry->key, key)) {
|
|
return entry;
|
|
return entry;
|
|
|
|
+ }
|
|
|
|
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|