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-08-26 00:03:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-26 00:03:45 +0400
commitbbce51d11691acc561f1684c20e60613941d4e9b (patch)
treeada2418ebb181015b561df9e9c92035ee2a84b43 /source/blender/editors
parent1d5eff36f5bd7fc7986e59d4dbe7b885ccb50e61 (diff)
replace hashes with sets where possible.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_filter.c9
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c24
2 files changed, 16 insertions, 17 deletions
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;
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index fc31aacffcf..345db7a0ed0 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -223,20 +223,20 @@ static void partialvis_update_grids(Object *ob,
}
static void partialvis_update_bmesh_verts(BMesh *bm,
- GHash *verts,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4],
- int *any_changed,
- int *any_visible)
+ GSet *verts,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4],
+ int *any_changed,
+ int *any_visible)
{
- GHashIterator gh_iter;
+ GSetIterator gs_iter;
- GHASH_ITER (gh_iter, verts) {
- BMVert *v = BLI_ghashIterator_getKey(&gh_iter);
+ GSET_ITER (gs_iter, verts) {
+ BMVert *v = BLI_gsetIterator_getKey(&gs_iter);
float *vmask = CustomData_bmesh_get(&bm->vdata,
- v->head.data,
- CD_PAINT_MASK);
+ v->head.data,
+ CD_PAINT_MASK);
/* hide vertex if in the hide volume */
if (is_effected(area, planes, v->co, *vmask)) {
@@ -260,7 +260,7 @@ static void partialvis_update_bmesh(Object *ob,
float planes[4][4])
{
BMesh *bm;
- GHash *unique, *other;
+ GSet *unique, *other;
int any_changed = 0, any_visible = 0;
bm = BKE_pbvh_get_bmesh(pbvh);