From bbce51d11691acc561f1684c20e60613941d4e9b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Aug 2013 20:03:45 +0000 Subject: replace hashes with sets where possible. --- source/blender/editors/animation/anim_filter.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/animation/anim_filter.c') diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 91003674524..14974cd070f 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -2533,13 +2533,13 @@ static size_t animdata_filter_remove_invalid(ListBase *anim_data) static size_t animdata_filter_remove_duplis(ListBase *anim_data) { bAnimListElem *ale, *next; - GHash *gh; + GSet *gs; size_t items = 0; /* build new hashtable to efficiently store and retrieve which entries have been * encountered already while searching */ - gh = BLI_ghash_ptr_new("animdata_filter_duplis_remove gh"); + gs = BLI_gset_ptr_new(__func__); /* loop through items, removing them from the list if a similar item occurs already */ for (ale = anim_data->first; ale; ale = next) { @@ -2549,9 +2549,8 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data) * - just use ale->data for now, though it would be nicer to involve * ale->type in combination too to capture corner cases (where same data performs differently) */ - if (BLI_ghash_haskey(gh, ale->data) == 0) { + if (BLI_gset_reinsert(gs, ale->data, NULL)) { /* this entry is 'unique' and can be kept */ - BLI_ghash_insert(gh, ale->data, NULL); items++; } else { @@ -2561,7 +2560,7 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data) } /* free the hash... */ - BLI_ghash_free(gh, NULL, NULL); + BLI_gset_free(gs, NULL); /* return the number of items still in the list */ return items; -- cgit v1.2.3