forked from bartvdbraak/blender
remove paranoid null check from BLI_ghash_lookup(), was the only ghash function with a null check, callers better check the ghash exists first.
This commit is contained in:
parent
b31d9c6cd0
commit
bc3cb6ff76
@ -78,9 +78,9 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
|
||||
unsigned int hash = gh->hashfp(key) % gh->nbuckets;
|
||||
Entry *e = (Entry *)BLI_mempool_alloc(gh->entrypool);
|
||||
|
||||
e->next = gh->buckets[hash];
|
||||
e->key = key;
|
||||
e->val = val;
|
||||
e->next = gh->buckets[hash];
|
||||
gh->buckets[hash] = e;
|
||||
|
||||
if (++gh->nentries > (float)gh->nbuckets / 2) {
|
||||
@ -109,13 +109,13 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
|
||||
|
||||
void *BLI_ghash_lookup(GHash *gh, const void *key)
|
||||
{
|
||||
if (gh) {
|
||||
unsigned int hash = gh->hashfp(key) % gh->nbuckets;
|
||||
Entry *e;
|
||||
const unsigned int hash = gh->hashfp(key) % gh->nbuckets;
|
||||
Entry *e;
|
||||
|
||||
for (e = gh->buckets[hash]; e; e = e->next)
|
||||
if (gh->cmpfp(key, e->key) == 0)
|
||||
return e->val;
|
||||
for (e = gh->buckets[hash]; e; e = e->next) {
|
||||
if (gh->cmpfp(key, e->key) == 0) {
|
||||
return e->val;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user