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>2014-04-15 08:17:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-15 08:22:36 +0400
commita7241d09cdd204a63e10a6e53c575f36639a3102 (patch)
treea436fbac1010ece84d9d15c617d5be3728469133 /source/blender/blenkernel/intern
parentea610e655cd8b8f9fb97f0a9a4fc5fd46418bd9e (diff)
GHash: add typed hash functions (were all (void *))
- BLI_ghashutil_strhash_n takes string length, to avoid terminating the string before hashing. - BLI_ghashutil_inthash/uinthash take ints, to avoid casting to (void *) This also showed up incorrect use of inthash, which was using a pointer.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/node.c6
-rw-r--r--source/blender/blenkernel/intern/treehash.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 47ef03093b1..a99d1303b85 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3591,9 +3591,9 @@ static void registerTextureNodes(void)
void init_nodesystem(void)
{
- nodetreetypes_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nodetreetypes_hash gh");
- nodetypes_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nodetypes_hash gh");
- nodesockettypes_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nodesockettypes_hash gh");
+ nodetreetypes_hash = BLI_ghash_str_new("nodetreetypes_hash gh");
+ nodetypes_hash = BLI_ghash_str_new("nodetypes_hash gh");
+ nodesockettypes_hash = BLI_ghash_str_new("nodesockettypes_hash gh");
register_undefined_types();
diff --git a/source/blender/blenkernel/intern/treehash.c b/source/blender/blenkernel/intern/treehash.c
index d1e9da72208..eda78d6c72e 100644
--- a/source/blender/blenkernel/intern/treehash.c
+++ b/source/blender/blenkernel/intern/treehash.c
@@ -78,8 +78,8 @@ static unsigned int tse_hash(const void *ptr)
const TreeStoreElem *tse = ptr;
unsigned int hash;
BLI_assert(tse->type || !tse->nr);
- hash = BLI_ghashutil_inthash(SET_INT_IN_POINTER((tse->nr << 16) + tse->type));
- hash ^= BLI_ghashutil_inthash(tse->id);
+ hash = BLI_ghashutil_inthash((tse->nr << 16) + tse->type);
+ hash ^= BLI_ghashutil_ptrhash(tse->id);
return hash;
}