diff options
Diffstat (limited to 'source/blender')
42 files changed, 93 insertions, 82 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; } diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index b2532d0e486..9034e8e51d9 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -147,6 +147,11 @@ int BLI_ghashutil_strcmp(const void *a, const void *b); unsigned int BLI_ghashutil_inthash(const void *ptr); int BLI_ghashutil_intcmp(const void *a, const void *b); +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); + typedef struct GHashPair { const void *first; const void *second; diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 6ec3d033672..5cfde3dfb77 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -305,6 +305,23 @@ int BLI_ghashutil_strcmp(const void *a, const void *b) return strcmp(a, b); } +GHash *BLI_ghash_ptr_new(const char *info) +{ + return BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, info); +} +GHash *BLI_ghash_str_new(const char *info) +{ + return BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, info); +} +GHash *BLI_ghash_int_new(const char *info) +{ + return BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, info); +} +GHash *BLI_ghash_pair_new(const char *info) +{ + return BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, info); +} + GHashPair *BLI_ghashutil_pairalloc(const void *first, const void *second) { GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair"); diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 73a90fa53a0..fdb0cc0ccc8 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -381,7 +381,7 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) GHash *map; int i, j, totface; - map = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "build_mesh_leaf_node gh"); + map = BLI_ghash_int_new("build_mesh_leaf_node gh"); node->uniq_verts = node->face_verts = 0; totface = node->totprim; @@ -1262,7 +1262,7 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot unsigned i; int tot; - map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "pbvh_get_grid_updates gh"); + map = BLI_ghash_ptr_new("pbvh_get_grid_updates gh"); pbvh_iter_begin(&iter, bvh, NULL, NULL); diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 4abbcb1888c..eb12a7bd837 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -221,7 +221,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) { FileData *fd = (FileData *) bh; - GHash *gathered = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "linkable_groups gh"); + GHash *gathered = BLI_ghash_ptr_new("linkable_groups gh"); LinkNode *names = NULL; BHead *bhead; diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index e20eb103e1b..736a43e1676 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -1833,7 +1833,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len) int i, maxindex; BMLoop *nl; - visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__); + visithash = BLI_ghash_ptr_new(__func__); maxindex = 0; BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index fe94983dc88..8d9f2ed7336 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -624,7 +624,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) int *new_idx = NULL; /* Init the old-to-new vert pointers mapping */ - vptr_map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BM_mesh_remap vert pointers mapping"); + vptr_map = BLI_ghash_ptr_new("BM_mesh_remap vert pointers mapping"); /* Make a copy of all vertices. */ verts_pool = MEM_callocN(sizeof(BMVert *) * totvert, "BM_mesh_remap verts pool"); @@ -658,7 +658,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) int *new_idx = NULL; /* Init the old-to-new vert pointers mapping */ - eptr_map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BM_mesh_remap edge pointers mapping"); + eptr_map = BLI_ghash_ptr_new("BM_mesh_remap edge pointers mapping"); /* Make a copy of all vertices. */ edges_pool = MEM_callocN(sizeof(BMEdge *) * totedge, "BM_mesh_remap edges pool"); @@ -691,7 +691,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) int *new_idx = NULL; /* Init the old-to-new vert pointers mapping */ - fptr_map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BM_mesh_remap face pointers mapping"); + fptr_map = BLI_ghash_ptr_new("BM_mesh_remap face pointers mapping"); /* Make a copy of all vertices. */ faces_pool = MEM_callocN(sizeof(BMFace *) * totface, "BM_mesh_remap faces pool"); diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 97347f841c8..b2d9590dc54 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -274,7 +274,7 @@ void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src, } if (!dest_slot->data.ghash) { - dest_slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh operator 2"); + dest_slot->data.ghash = BLI_ghash_ptr_new("bmesh operator 2"); } BLI_ghashIterator_init(&it, source_slot->data.ghash); @@ -556,7 +556,7 @@ void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname memcpy(mapping + 1, data, len); if (!slot->data.ghash) { - slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh slot map hash"); + slot->data.ghash = BLI_ghash_ptr_new("bmesh slot map hash"); } BLI_ghash_insert(slot->data.ghash, element, mapping); diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c index ea29c149c1a..79e097a7a7c 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.c +++ b/source/blender/bmesh/intern/bmesh_walkers.c @@ -87,8 +87,8 @@ void BMW_init(BMWalker *walker, BMesh *bm, int type, walker->mask_edge = mask_edge; walker->mask_face = mask_face; - walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 1"); - walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers sec 1"); + walker->visithash = BLI_ghash_ptr_new("bmesh walkers 1"); + walker->secvisithash = BLI_ghash_ptr_new("bmesh walkers sec 1"); if (UNLIKELY(type >= BMW_MAXWALKERS || type < 0)) { fprintf(stderr, @@ -254,6 +254,6 @@ void BMW_reset(BMWalker *walker) walker->depth = 0; BLI_ghash_free(walker->visithash, NULL, NULL); BLI_ghash_free(walker->secvisithash, NULL, NULL); - walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 1"); - walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers sec 1"); + walker->visithash = BLI_ghash_ptr_new("bmesh walkers 1"); + walker->secvisithash = BLI_ghash_ptr_new("bmesh walkers sec 1"); } diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 01c269657dc..4ae7b6cc350 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -482,7 +482,7 @@ static void bmw_LoopWalker_begin(BMWalker *walker, void *data) lwalk->lastv = lwalk->startv = BM_edge_other_vert(owalk.cur, lwalk->lastv); BLI_ghash_free(walker->visithash, NULL, NULL); - walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 2"); + walker->visithash = BLI_ghash_ptr_new("bmesh walkers 2"); BLI_ghash_insert(walker->visithash, owalk.cur, NULL); } @@ -707,11 +707,11 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data) lwalk->nocalc = 0; BLI_ghash_free(walker->secvisithash, NULL, NULL); - walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 3"); + walker->secvisithash = BLI_ghash_ptr_new("bmesh walkers 3"); BLI_ghash_insert(walker->visithash, lwalk->l->e, NULL); BLI_ghash_free(walker->visithash, NULL, NULL); - walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 3"); + walker->visithash = BLI_ghash_ptr_new("bmesh walkers 3"); BLI_ghash_insert(walker->visithash, lwalk->l->f, NULL); } @@ -814,7 +814,7 @@ static void bmw_EdgeringWalker_begin(BMWalker *walker, void *data) } BLI_ghash_free(walker->visithash, NULL, NULL); - walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 4"); + walker->visithash = BLI_ghash_ptr_new("bmesh walkers 4"); BLI_ghash_insert(walker->visithash, lwalk->l->e, NULL); } 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); diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index df031a50d54..101614d609c 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -72,7 +72,7 @@ BME_TransData_Head *BME_init_transdata(int bufsize) BME_TransData_Head *td; td = MEM_callocN(sizeof(BME_TransData_Head), "BM transdata header"); - td->gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BME_init_transdata gh"); + td->gh = BLI_ghash_ptr_new("BME_init_transdata gh"); td->ma = BLI_memarena_new(bufsize, "BME_TransData arena"); BLI_memarena_use_calloc(td->ma); 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) { diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 4f7fc3639f4..6a2c3eee7a5 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -232,7 +232,7 @@ static char *gpu_generate_function_prototyps(GHash *hash) GPUFunction *GPU_lookup_function(const char *name) { if (!FUNCTION_HASH) { - FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "GPU_lookup_function gh"); + FUNCTION_HASH = BLI_ghash_str_new("GPU_lookup_function gh"); gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library); /*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH); FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/ @@ -375,8 +375,8 @@ static void codegen_set_unique_ids(ListBase *nodes) GPUOutput *output; int id = 1, texid = 0; - bindhash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "codegen_set_unique_ids1 gh"); - definehash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "codegen_set_unique_ids2 gh"); + bindhash= BLI_ghash_ptr_new("codegen_set_unique_ids1 gh"); + definehash= BLI_ghash_ptr_new("codegen_set_unique_ids2 gh"); for (node=nodes->first; node; node=node->next) { for (input=node->inputs.first; input; input=input->next) { diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 472278340e5..80c80d02e06 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -496,7 +496,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) #ifdef WITH_DNA_GHASH /* create a ghash lookup to speed up */ - sdna->structs_map = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "init_structDNA gh"); + sdna->structs_map = BLI_ghash_str_new("init_structDNA gh"); for (nr = 0; nr < sdna->nr_structs; nr++) { sp = sdna->structs[nr]; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 3079ba8c8d8..0a07887f196 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -74,7 +74,7 @@ void RNA_init(void) for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) { if (!srna->cont.prophash) { - srna->cont.prophash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "RNA_init gh"); + srna->cont.prophash = BLI_ghash_str_new("RNA_init gh"); for (prop = srna->cont.properties.first; prop; prop = prop->next) if (!(prop->flag & PROP_BUILTIN)) diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 39344aad5a9..1b4d9444fd9 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -381,7 +381,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( } // a hash table to remap materials to indices - material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "CSG_mat gh"); + material_hash = BLI_ghash_ptr_new("CSG_mat gh"); if (mat) *totmat = 0; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 9285ec6674c..121b0ee89e3 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -90,13 +90,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), MLoop *ml_dst, *ml_src /*, *mloop_dst */; GHashIterator *hashIter; /* maps vert indices in old mesh to indices in new mesh */ - GHash *vertHash = BLI_ghash_new(BLI_ghashutil_inthash, - BLI_ghashutil_intcmp, "build ve apply gh"); + GHash *vertHash = BLI_ghash_int_new("build ve apply gh"); /* maps edge indices in new mesh to indices in old mesh */ - GHash *edgeHash = BLI_ghash_new(BLI_ghashutil_inthash, - BLI_ghashutil_intcmp, "build ed apply gh"); - GHash *edgeHash2 = BLI_ghash_new(BLI_ghashutil_inthash, - BLI_ghashutil_intcmp, "build ed apply gh"); + GHash *edgeHash = BLI_ghash_int_new("build ed apply gh"); + GHash *edgeHash2 = BLI_ghash_int_new("build ed apply gh"); const int numVert_src = dm->getNumVerts(dm); const int numEdge_src = dm->getNumEdges(dm); diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 396e48df50c..5206aa281f7 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -167,7 +167,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, * - vgroups to indices -> vgroupHash (string, int) * - bones to vgroup indices -> boneHash (index of vgroup, dummy) */ - vgroupHash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "mask vgroup gh"); + vgroupHash = BLI_ghash_str_new("mask vgroup gh"); /* build mapping of names of vertex groups to indices */ for (i = 0, def = ob->defbase.first; def; def = def->next, i++) @@ -191,7 +191,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } /* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */ - vertHash = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask vert gh"); + vertHash = BLI_ghash_int_new("mask vert gh"); /* add vertices which exist in vertexgroups into vertHash for filtering */ for (i = 0, dv = dvert; i < maxVerts; i++, dv++) { @@ -239,7 +239,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, return dm; /* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */ - vertHash = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask vert2 bh"); + vertHash = BLI_ghash_int_new("mask vert2 bh"); /* add vertices which exist in vertexgroup into ghash for filtering */ for (i = 0, dv = dvert; i < maxVerts; i++, dv++) { @@ -262,8 +262,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } /* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */ - edgeHash = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask ed2 gh"); - polyHash = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask fa2 gh"); + edgeHash = BLI_ghash_int_new("mask ed2 gh"); + polyHash = BLI_ghash_int_new("mask fa2 gh"); mpoly = dm->getPolyArray(dm); mloop = dm->getLoopArray(dm); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 6c1e811aae0..f20e029c7b6 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -176,13 +176,13 @@ static GHash *id_weakref_pool_get(ID *id) } else { /* first time, allocate pool */ - id_weakref_pool = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_global_pool"); + id_weakref_pool = BLI_ghash_ptr_new("rna_global_pool"); weakinfo_hash = NULL; } if (weakinfo_hash == NULL) { /* we're using a ghash as a set, could use libHX's HXMAP_SINGULAR but would be an extra dep. */ - weakinfo_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "rna_id"); + weakinfo_hash = BLI_ghash_ptr_new("rna_id"); BLI_ghash_insert(id_weakref_pool, (void *)id, weakinfo_hash); } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index f16c1b5e673..c2b0e1e777f 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -902,7 +902,7 @@ static float *get_object_orco(Render *re, Object *ob) float *orco; if (!re->orco_hash) - re->orco_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "get_object_orco gh"); + re->orco_hash = BLI_ghash_ptr_new("get_object_orco gh"); orco = BLI_ghash_lookup(re->orco_hash, ob); @@ -924,7 +924,7 @@ static float *get_object_orco(Render *re, Object *ob) static void set_object_orco(Render *re, void *ob, float *orco) { if (!re->orco_hash) - re->orco_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "set_object_orco gh"); + re->orco_hash = BLI_ghash_ptr_new("set_object_orco gh"); BLI_ghash_insert(re->orco_hash, ob, orco); } diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index c8a37998169..690598d8c05 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -990,7 +990,7 @@ void make_sss_tree(Render *re) { Material *mat; - re->sss_hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_sss_tree gh"); + re->sss_hash= BLI_ghash_ptr_new("make_sss_tree gh"); re->i.infostr= "SSS preprocessing"; re->stats_draw(re->sdh, &re->i); diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 6690425967c..02d342754ea 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -333,8 +333,8 @@ StrandShadeCache *strand_shade_cache_create(void) StrandShadeCache *cache; cache= MEM_callocN(sizeof(StrandShadeCache), "StrandShadeCache"); - cache->resulthash= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "strand_shade_cache_create1 gh"); - cache->refcounthash= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "strand_shade_cache_create2 gh"); + cache->resulthash= BLI_ghash_pair_new("strand_shade_cache_create1 gh"); + cache->refcounthash= BLI_ghash_pair_new("strand_shade_cache_create2 gh"); cache->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand shade cache arena"); return cache; diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 7285e155dc6..a34d294461c 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -183,7 +183,7 @@ void WM_menutype_freelink(MenuType *mt) /* called on initialize WM_init() */ void WM_menutype_init(void) { - menutypes_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "menutypes_hash gh"); + menutypes_hash = BLI_ghash_str_new("menutypes_hash gh"); } void WM_menutype_free(void) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index c18625c0168..7f3a93258da 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3740,7 +3740,7 @@ void wm_operatortype_free(void) /* called on initialize WM_init() */ void wm_operatortype_init(void) { - global_ops_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wm_operatortype_init gh"); + global_ops_hash = BLI_ghash_str_new("wm_operatortype_init gh"); WM_operatortype_append(WM_OT_window_duplicate); WM_operatortype_append(WM_OT_read_homefile); |