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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user