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/bmesh/operators | |
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/bmesh/operators')
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dupe.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_hull.c | 12 |
3 files changed, 6 insertions, 12 deletions
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 85aed6141bb..7ef6068247d 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -733,7 +733,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E VertData *vdata, PathBase *pathbase, int group) { BMEdge *e; - GHash *gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createops find shortest path"); + GHash *gh = BLI_ghash_ptr_new("createops find shortest path"); BMVert *v1, *v2; BMVert **verts = NULL; BLI_array_staticdeclare(verts, 1024); diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 212ec33e626..ae001b2baf6 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -197,8 +197,8 @@ static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target) GHash *vhash, *ehash; /* initialize pointer hashes */ - vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops v"); - ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops e"); + vhash = BLI_ghash_ptr_new("bmesh dupeops v"); + ehash = BLI_ghash_ptr_new("bmesh dupeops e"); /* duplicate flagged vertices */ BM_ITER_MESH (v, &viter, source, BM_VERTS_OF_MESH) { diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 20d0160311d..2a48a531566 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -154,9 +154,7 @@ static GHash *hull_triangles_v_outside(GHash *hull_triangles, const BMVert *v) GHash *outside; GHashIterator iter; - outside = BLI_ghash_new(BLI_ghashutil_ptrhash, - BLI_ghashutil_ptrcmp, - "outside"); + outside = BLI_ghash_ptr_new("outside"); GHASH_ITER (iter, hull_triangles) { HullTriangle *t = BLI_ghashIterator_getKey(&iter); @@ -298,9 +296,7 @@ static HullFinalEdges *hull_final_edges(GHash *hull_triangles) GHashIterator iter; final_edges = MEM_callocN(sizeof(HullFinalEdges), "HullFinalEdges"); - final_edges->edges = BLI_ghash_new(BLI_ghashutil_ptrhash, - BLI_ghashutil_ptrcmp, - "final edges ghash"); + final_edges->edges = BLI_ghash_ptr_new("final edges ghash"); final_edges->base_pool = BLI_mempool_create(sizeof(ListBase), 128, 128, 0); final_edges->link_pool = BLI_mempool_create(sizeof(LinkData), 128, 128, 0); @@ -683,9 +679,7 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op) edge_pool = BLI_mempool_create(sizeof(HullBoundaryEdge), 128, 128, 0); hull_pool = BLI_mempool_create(sizeof(HullTriangle), 128, 128, 0); - hull_triangles = BLI_ghash_new(BLI_ghashutil_ptrhash, - BLI_ghashutil_ptrcmp, - "hull_triangles"); + hull_triangles = BLI_ghash_ptr_new("hull_triangles"); /* Add tetrahedron triangles */ hull_add_tetrahedron(bm, hull_triangles, hull_pool, tetra); |