Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-02-03 19:03:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-02-03 19:03:55 +0400
commitbc3cb6ff766eadeeb358dbf2fac5a76db58355db (patch)
tree4d73d4e67cddf2dffecde99c8b635d002910b278 /source/blender/blenlib
parentb31d9c6cd07b41bfe1ad3d22651266bb4726cd84 (diff)
remove paranoid null check from BLI_ghash_lookup(), was the only ghash function with a null check, callers better check the ghash exists first.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 7d2fc38272d..7ebe4430e20 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -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;
}