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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-05-16 04:51:36 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-05-16 04:51:36 +0400
commited33320e3f149f4106ed70b82d019113970c991e (patch)
tree49aaa5a8f7e53e7065fb758c86c73eddc20d3b9f /source/blender/editors
parenteb22b5248229494bcab091e68cf7a354fe0cc0e3 (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/editors')
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c6
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c2
-rw-r--r--source/blender/editors/armature/reeb.c4
-rw-r--r--source/blender/editors/curve/editcurve.c4
-rw-r--r--source/blender/editors/interface/interface_ops.c4
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c6
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/object/object_add.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
11 files changed, 18 insertions, 20 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 2729396cb4a..fcf424e34dc 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2223,7 +2223,7 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data)
/* build new hashtable to efficiently store and retrieve which entries have been
* encountered already while searching
*/
- gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "animdata_filter_duplis_remove gh");
+ gh = BLI_ghash_ptr_new("animdata_filter_duplis_remove gh");
/* loop through items, removing them from the list if a similar item occurs already */
for (ale = anim_data->first; ale; ale = next) {
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 8e2dfb72703..7ce2988b067 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -5945,7 +5945,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
ED_armature_to_edit(obedit);
- arcBoneMap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "SkeletonFromReebGraph gh");
+ arcBoneMap = BLI_ghash_ptr_new("SkeletonFromReebGraph gh");
BLI_markdownSymmetry((BGraph *)rg, rg->nodes.first, scene->toolsettings->skgen_symmetry_limit);
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 566dbc901b8..80f8c61694c 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -298,8 +298,8 @@ static RigGraph *newRigGraph(void)
rg->head = NULL;
- rg->bones_map = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "newRigGraph bones gh");
- rg->controls_map = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "newRigGraph cont gh");
+ rg->bones_map = BLI_ghash_str_new("newRigGraph bones gh");
+ rg->controls_map = BLI_ghash_str_new("newRigGraph cont gh");
rg->free_arc = RIG_freeRigArc;
rg->free_node = NULL;
@@ -532,7 +532,7 @@ static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob, c
RigControl *ctrl;
RigGraph *rg;
- ptr_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "cloneRigGraph gh");
+ ptr_hash = BLI_ghash_ptr_new("cloneRigGraph gh");
rg = newRigGraph();
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 2201bcf7224..06ecf76ba3e 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -165,7 +165,7 @@ void BIF_makeListTemplates(const bContext *C)
BLI_ghash_free(TEMPLATES_HASH, NULL, NULL);
}
- TEMPLATES_HASH = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "makeListTemplates gh");
+ TEMPLATES_HASH = BLI_ghash_int_new("makeListTemplates gh");
TEMPLATES_CURRENT = 0;
for (base = FIRSTBASE; base; base = base->next) {
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 2564683ddd2..316c4699c0b 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -354,7 +354,7 @@ static ReebArc *copyArc(ReebGraph *rg, ReebArc *arc)
memcpy(cp_arc->buckets, arc->buckets, sizeof(EmbedBucket) * cp_arc->bcount);
/* copy faces map */
- cp_arc->faces = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "copyArc gh");
+ cp_arc->faces = BLI_ghash_ptr_new("copyArc gh");
mergeArcFaces(rg, cp_arc, arc);
/* find corresponding head and tail */
@@ -2295,7 +2295,7 @@ static ReebEdge *createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
arc->flag = 0; // clear flag on init
arc->symmetry_level = 0;
- arc->faces = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createArc gh");
+ arc->faces = BLI_ghash_ptr_new("createArc gh");
if (node1->weight <= node2->weight) {
v1 = node1;
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index e2824ee35cc..7afba049232 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -311,7 +311,7 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
if (editnurb->keyindex) return;
- gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "editNurb keyIndex");
+ gh = BLI_ghash_ptr_new("editNurb keyIndex");
while (orignu) {
if (orignu->bezt) {
@@ -667,7 +667,7 @@ static GHash *dupli_keyIndexHash(GHash *keyindex)
GHash *gh;
GHashIterator *hashIter;
- gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "dupli_keyIndex gh");
+ gh = BLI_ghash_ptr_new("dupli_keyIndex gh");
for (hashIter = BLI_ghashIterator_new(keyindex);
!BLI_ghashIterator_isDone(hashIter);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 6d2ac388374..f2a43580fd8 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -589,9 +589,7 @@ static void ui_editsource_active_but_set(uiBut *but)
ui_editsource_info = MEM_callocN(sizeof(uiEditSourceStore), __func__);
memcpy(&ui_editsource_info->but_orig, but, sizeof(uiBut));
- ui_editsource_info->hash = BLI_ghash_new(BLI_ghashutil_ptrhash,
- BLI_ghashutil_ptrcmp,
- __func__);
+ ui_editsource_info->hash = BLI_ghash_ptr_new(__func__);
}
static void ui_editsource_active_but_clear(void)
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index d49b77c7005..a9ec893adb7 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2829,9 +2829,9 @@ static int knifetool_init(bContext *C, wmOperator *op, int UNUSED(do_cut))
kcd->kverts = BLI_mempool_create(sizeof(KnifeVert), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
kcd->kedges = BLI_mempool_create(sizeof(KnifeEdge), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
- kcd->origedgemap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origedgemap");
- kcd->origvertmap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origvertmap");
- kcd->kedgefacemap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origvertmap");
+ kcd->origedgemap = BLI_ghash_ptr_new("knife origedgemap");
+ kcd->origvertmap = BLI_ghash_ptr_new("knife origvertmap");
+ kcd->kedgefacemap = BLI_ghash_ptr_new("knife origvertmap");
/* cut all the way through the mesh if use_occlude_geometry button not pushed */
kcd->cut_through = !RNA_boolean_get(op->ptr, "use_occlude_geometry");
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9be71218da0..7f746ed9ef5 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -2700,7 +2700,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
}
/* the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer */
- gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife cut exec");
+ gh = BLI_ghash_ptr_new("knife cut exec");
for (bv = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); bv; bv = BM_iter_step(&iter)) {
scr = MEM_mallocN(sizeof(float) * 2, "Vertex Screen Coordinates");
copy_v3_v3(co, bv->co);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 466338a736f..69aae5c4f06 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1067,8 +1067,8 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
lb = object_duplilist(scene, base->object);
if (use_hierarchy || use_base_parent) {
- dupli_gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_object_duplilist_real dupli_gh");
- parent_gh = BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "make_object_duplilist_real parent_gh");
+ dupli_gh = BLI_ghash_ptr_new("make_object_duplilist_real dupli_gh");
+ parent_gh = BLI_ghash_pair_new("make_object_duplilist_real parent_gh");
}
for (dob = lb->first; dob; dob = dob->next) {
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 3b74ae54810..d544183ced8 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2079,7 +2079,7 @@ static char *wpaint_make_validmap(Object *ob)
return NULL;
}
- gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
+ gh = BLI_ghash_str_new("wpaint_make_validmap gh");
/* add all names to a hash table */
for (dg = ob->defbase.first; dg; dg = dg->next) {