diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-16 04:51:36 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-16 04:51:36 +0400 |
commit | ed33320e3f149f4106ed70b82d019113970c991e (patch) | |
tree | 49aaa5a8f7e53e7065fb758c86c73eddc20d3b9f /source/blender/blenkernel | |
parent | eb22b5248229494bcab091e68cf7a354fe0cc0e3 (diff) |
Code cleanup: simplify standard GHash creation.
Added four new functions as shortcuts to creating GHashes that use the
standard ptr/str/int/pair hash and compare functions.
GHash *BLI_ghash_ptr_new(const char *info);
GHash *BLI_ghash_str_new(const char *info);
GHash *BLI_ghash_int_new(const char *info);
GHash *BLI_ghash_pair_new(const char *info);
Replaced almost all occurrences of BLI_ghash_new() with one of the
above functions.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/icons.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 9e46d03a3ab..0f8716e2b04 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -574,7 +574,7 @@ void BKE_pose_channels_hash_make(bPose *pose) if (!pose->chanhash) { bPoseChannel *pchan; - pose->chanhash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "make_pose_chan gh"); + pose->chanhash = BLI_ghash_str_new("make_pose_chan gh"); for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) BLI_ghash_insert(pose->chanhash, pchan->name, pchan); } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index c6f46a7309b..31d2ef9175b 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -867,7 +867,7 @@ DagNode *dag_add_node(DagForest *forest, void *fob) } if (!forest->nodeHash) - forest->nodeHash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "dag_add_node gh"); + forest->nodeHash = BLI_ghash_ptr_new("dag_add_node gh"); BLI_ghash_insert(forest->nodeHash, fob, node); } diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 5990e92798e..8a49cba7649 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -103,7 +103,7 @@ void BKE_icons_init(int first_dyn_id) gFirstIconId = first_dyn_id; if (!gIcons) - gIcons = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "icons_init gh"); + gIcons = BLI_ghash_int_new("icons_init gh"); } void BKE_icons_free(void) diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 02d44badc65..2b4fe72e8bb 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1304,7 +1304,7 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip) * - this is easier than iterating over all the tracks+strips hierarchy everytime * (and probably faster) */ - gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "nlastrip_validate_name gh"); + gh = BLI_ghash_str_new("nlastrip_validate_name gh"); for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { for (tstrip = nlt->strips.first; tstrip; tstrip = tstrip->next) { diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index ee70d4228de..a66b8a1a373 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3669,7 +3669,7 @@ static void sb_new_scratch(SoftBody *sb) { if (!sb) return; sb->scratch = MEM_callocN(sizeof(SBScratch), "SBScratch"); - sb->scratch->colliderhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "sb_new_scratch gh"); + sb->scratch->colliderhash = BLI_ghash_ptr_new("sb_new_scratch gh"); sb->scratch->bodyface = NULL; sb->scratch->totface = 0; sb->scratch->aabbmax[0]=sb->scratch->aabbmax[1]=sb->scratch->aabbmax[2] = 1.0e30f; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 4e2b4be474b..8339e973d43 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -768,7 +768,7 @@ static TracksMap *tracks_map_new(const char *object_name, int is_camera, int num if (customdata_size) map->customdata = MEM_callocN(customdata_size*num_tracks, "TracksMap customdata"); - map->hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "TracksMap hash"); + map->hash = BLI_ghash_ptr_new("TracksMap hash"); return map; } |