forked from bartvdbraak/blender
GHash: avoid redundant casts
This commit is contained in:
parent
18cf235893
commit
097862cb26
@ -38,7 +38,7 @@ typedef struct bAddonPrefType {
|
|||||||
|
|
||||||
bAddonPrefType *BKE_addon_pref_type_find(const char *idname, bool quiet);
|
bAddonPrefType *BKE_addon_pref_type_find(const char *idname, bool quiet);
|
||||||
void BKE_addon_pref_type_add(bAddonPrefType *apt);
|
void BKE_addon_pref_type_add(bAddonPrefType *apt);
|
||||||
void BKE_addon_pref_type_remove(bAddonPrefType *apt);
|
void BKE_addon_pref_type_remove(const bAddonPrefType *apt);
|
||||||
|
|
||||||
void BKE_addon_pref_type_init(void);
|
void BKE_addon_pref_type_init(void);
|
||||||
void BKE_addon_pref_type_free(void);
|
void BKE_addon_pref_type_free(void);
|
||||||
|
@ -319,7 +319,7 @@ typedef struct bNodeTreeType {
|
|||||||
|
|
||||||
struct bNodeTreeType *ntreeTypeFind(const char *idname);
|
struct bNodeTreeType *ntreeTypeFind(const char *idname);
|
||||||
void ntreeTypeAdd(struct bNodeTreeType *nt);
|
void ntreeTypeAdd(struct bNodeTreeType *nt);
|
||||||
void ntreeTypeFreeLink(struct bNodeTreeType *nt);
|
void ntreeTypeFreeLink(const struct bNodeTreeType *nt);
|
||||||
bool ntreeIsRegistered(struct bNodeTree *ntree);
|
bool ntreeIsRegistered(struct bNodeTree *ntree);
|
||||||
struct GHashIterator *ntreeTypeGetIterator(void);
|
struct GHashIterator *ntreeTypeGetIterator(void);
|
||||||
|
|
||||||
|
@ -62,12 +62,12 @@ bAddonPrefType *BKE_addon_pref_type_find(const char *idname, bool quiet)
|
|||||||
|
|
||||||
void BKE_addon_pref_type_add(bAddonPrefType *apt)
|
void BKE_addon_pref_type_add(bAddonPrefType *apt)
|
||||||
{
|
{
|
||||||
BLI_ghash_insert(global_addonpreftype_hash, (void *)apt->idname, apt);
|
BLI_ghash_insert(global_addonpreftype_hash, apt->idname, apt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_addon_pref_type_remove(bAddonPrefType *apt)
|
void BKE_addon_pref_type_remove(const bAddonPrefType *apt)
|
||||||
{
|
{
|
||||||
BLI_ghash_remove(global_addonpreftype_hash, (void *)apt->idname, NULL, MEM_freeN);
|
BLI_ghash_remove(global_addonpreftype_hash, apt->idname, NULL, MEM_freeN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_addon_pref_type_init(void)
|
void BKE_addon_pref_type_init(void)
|
||||||
|
@ -1176,7 +1176,7 @@ void BKE_sim_debug_data_clear_category(const char *category)
|
|||||||
GHashIterator iter;
|
GHashIterator iter;
|
||||||
BLI_ghashIterator_init(&iter, _sim_debug_data->gh);
|
BLI_ghashIterator_init(&iter, _sim_debug_data->gh);
|
||||||
while (!BLI_ghashIterator_done(&iter)) {
|
while (!BLI_ghashIterator_done(&iter)) {
|
||||||
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
|
const SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
|
||||||
BLI_ghashIterator_step(&iter); /* removing invalidates the current iterator, so step before removing */
|
BLI_ghashIterator_step(&iter); /* removing invalidates the current iterator, so step before removing */
|
||||||
|
|
||||||
if (elem->category_hash == category_hash)
|
if (elem->category_hash == category_hash)
|
||||||
|
@ -303,7 +303,7 @@ bNodeTreeType *ntreeTypeFind(const char *idname)
|
|||||||
|
|
||||||
void ntreeTypeAdd(bNodeTreeType *nt)
|
void ntreeTypeAdd(bNodeTreeType *nt)
|
||||||
{
|
{
|
||||||
BLI_ghash_insert(nodetreetypes_hash, (void *)nt->idname, nt);
|
BLI_ghash_insert(nodetreetypes_hash, nt->idname, nt);
|
||||||
/* XXX pass Main to register function? */
|
/* XXX pass Main to register function? */
|
||||||
update_typeinfo(G.main, NULL, nt, NULL, NULL, false);
|
update_typeinfo(G.main, NULL, nt, NULL, NULL, false);
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ static void ntree_free_type(void *treetype_v)
|
|||||||
MEM_freeN(treetype);
|
MEM_freeN(treetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ntreeTypeFreeLink(bNodeTreeType *nt)
|
void ntreeTypeFreeLink(const bNodeTreeType *nt)
|
||||||
{
|
{
|
||||||
BLI_ghash_remove(nodetreetypes_hash, nt->idname, NULL, ntree_free_type);
|
BLI_ghash_remove(nodetreetypes_hash, nt->idname, NULL, ntree_free_type);
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ void nodeRegisterType(bNodeType *nt)
|
|||||||
BLI_assert(nt->idname[0] != '\0');
|
BLI_assert(nt->idname[0] != '\0');
|
||||||
BLI_assert(nt->poll != NULL);
|
BLI_assert(nt->poll != NULL);
|
||||||
|
|
||||||
BLI_ghash_insert(nodetypes_hash, (void *)nt->idname, nt);
|
BLI_ghash_insert(nodetypes_hash, nt->idname, nt);
|
||||||
/* XXX pass Main to register function? */
|
/* XXX pass Main to register function? */
|
||||||
update_typeinfo(G.main, NULL, NULL, nt, NULL, false);
|
update_typeinfo(G.main, NULL, NULL, nt, NULL, false);
|
||||||
}
|
}
|
||||||
|
@ -1497,7 +1497,7 @@ void BM_mesh_remap(
|
|||||||
BMVert *new_vep = verts_pool[*new_idx];
|
BMVert *new_vep = verts_pool[*new_idx];
|
||||||
*new_vep = *ve;
|
*new_vep = *ve;
|
||||||
/* printf("mapping vert from %d to %d (%p/%p to %p)\n", i, *new_idx, *vep, verts_pool[i], new_vep);*/
|
/* printf("mapping vert from %d to %d (%p/%p to %p)\n", i, *new_idx, *vep, verts_pool[i], new_vep);*/
|
||||||
BLI_ghash_insert(vptr_map, (void *)*vep, (void *)new_vep);
|
BLI_ghash_insert(vptr_map, *vep, new_vep);
|
||||||
}
|
}
|
||||||
bm->elem_index_dirty |= BM_VERT;
|
bm->elem_index_dirty |= BM_VERT;
|
||||||
bm->elem_table_dirty |= BM_VERT;
|
bm->elem_table_dirty |= BM_VERT;
|
||||||
@ -1528,7 +1528,7 @@ void BM_mesh_remap(
|
|||||||
for (i = totedge; i--; new_idx--, ed--, edp--) {
|
for (i = totedge; i--; new_idx--, ed--, edp--) {
|
||||||
BMEdge *new_edp = edges_pool[*new_idx];
|
BMEdge *new_edp = edges_pool[*new_idx];
|
||||||
*new_edp = *ed;
|
*new_edp = *ed;
|
||||||
BLI_ghash_insert(eptr_map, (void *)*edp, (void *)new_edp);
|
BLI_ghash_insert(eptr_map, *edp, new_edp);
|
||||||
/* printf("mapping edge from %d to %d (%p/%p to %p)\n", i, *new_idx, *edp, edges_pool[i], new_edp);*/
|
/* printf("mapping edge from %d to %d (%p/%p to %p)\n", i, *new_idx, *edp, edges_pool[i], new_edp);*/
|
||||||
}
|
}
|
||||||
bm->elem_index_dirty |= BM_EDGE;
|
bm->elem_index_dirty |= BM_EDGE;
|
||||||
@ -1560,7 +1560,7 @@ void BM_mesh_remap(
|
|||||||
for (i = totface; i--; new_idx--, fa--, fap--) {
|
for (i = totface; i--; new_idx--, fa--, fap--) {
|
||||||
BMFace *new_fap = faces_pool[*new_idx];
|
BMFace *new_fap = faces_pool[*new_idx];
|
||||||
*new_fap = *fa;
|
*new_fap = *fa;
|
||||||
BLI_ghash_insert(fptr_map, (void *)*fap, (void *)new_fap);
|
BLI_ghash_insert(fptr_map, *fap, new_fap);
|
||||||
}
|
}
|
||||||
|
|
||||||
bm->elem_index_dirty |= BM_FACE | BM_LOOP;
|
bm->elem_index_dirty |= BM_FACE | BM_LOOP;
|
||||||
|
@ -327,17 +327,17 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
|
|||||||
editnurb->keyindex = gh;
|
editnurb->keyindex = gh;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, void *cv)
|
static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, const void *cv)
|
||||||
{
|
{
|
||||||
return BLI_ghash_lookup(editnurb->keyindex, cv);
|
return BLI_ghash_lookup(editnurb->keyindex, cv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CVKeyIndex *popCVKeyIndex(EditNurb *editnurb, void *cv)
|
static CVKeyIndex *popCVKeyIndex(EditNurb *editnurb, const void *cv)
|
||||||
{
|
{
|
||||||
return BLI_ghash_popkey(editnurb->keyindex, cv, NULL);
|
return BLI_ghash_popkey(editnurb->keyindex, cv, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BezTriple *getKeyIndexOrig_bezt(EditNurb *editnurb, BezTriple *bezt)
|
static BezTriple *getKeyIndexOrig_bezt(EditNurb *editnurb, const BezTriple *bezt)
|
||||||
{
|
{
|
||||||
CVKeyIndex *index = getCVKeyIndex(editnurb, bezt);
|
CVKeyIndex *index = getCVKeyIndex(editnurb, bezt);
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ static int getKeyIndexOrig_keyIndex(EditNurb *editnurb, void *cv)
|
|||||||
return index->key_index;
|
return index->key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyIndex_delCV(EditNurb *editnurb, void *cv)
|
static void keyIndex_delCV(EditNurb *editnurb, const void *cv)
|
||||||
{
|
{
|
||||||
if (!editnurb->keyindex) {
|
if (!editnurb->keyindex) {
|
||||||
return;
|
return;
|
||||||
@ -398,7 +398,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nu->bezt) {
|
if (nu->bezt) {
|
||||||
BezTriple *bezt = nu->bezt;
|
const BezTriple *bezt = nu->bezt;
|
||||||
a = nu->pntsu;
|
a = nu->pntsu;
|
||||||
|
|
||||||
while (a--) {
|
while (a--) {
|
||||||
@ -407,7 +407,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BPoint *bp = nu->bp;
|
const BPoint *bp = nu->bp;
|
||||||
a = nu->pntsu * nu->pntsv;
|
a = nu->pntsu * nu->pntsv;
|
||||||
|
|
||||||
while (a--) {
|
while (a--) {
|
||||||
|
@ -147,8 +147,8 @@ static void check_unused_keys(MovieCache *cache)
|
|||||||
BLI_ghashIterator_init(&gh_iter, cache->hash);
|
BLI_ghashIterator_init(&gh_iter, cache->hash);
|
||||||
|
|
||||||
while (!BLI_ghashIterator_done(&gh_iter)) {
|
while (!BLI_ghashIterator_done(&gh_iter)) {
|
||||||
MovieCacheKey *key = BLI_ghashIterator_getKey(&gh_iter);
|
const MovieCacheKey *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||||
MovieCacheItem *item = BLI_ghashIterator_getValue(&gh_iter);
|
const MovieCacheItem *item = BLI_ghashIterator_getValue(&gh_iter);
|
||||||
bool remove;
|
bool remove;
|
||||||
|
|
||||||
BLI_ghashIterator_step(&gh_iter);
|
BLI_ghashIterator_step(&gh_iter);
|
||||||
|
@ -525,7 +525,7 @@ static void init_structDNA(SDNA *sdna, bool do_endian_swap)
|
|||||||
|
|
||||||
for (nr = 0; nr < sdna->nr_structs; nr++) {
|
for (nr = 0; nr < sdna->nr_structs; nr++) {
|
||||||
sp = sdna->structs[nr];
|
sp = sdna->structs[nr];
|
||||||
BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], (void *)(nr + 1));
|
BLI_ghash_insert(sdna->structs_map, sdna->types[sp[0]], SET_INT_IN_POINTER(nr + 1));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -3411,7 +3411,7 @@ static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop)
|
|||||||
|
|
||||||
if (prop->flag & PROP_RUNTIME) {
|
if (prop->flag & PROP_RUNTIME) {
|
||||||
if (cont->prophash)
|
if (cont->prophash)
|
||||||
BLI_ghash_remove(cont->prophash, (void *)prop->identifier, NULL, NULL);
|
BLI_ghash_remove(cont->prophash, prop->identifier, NULL, NULL);
|
||||||
|
|
||||||
RNA_def_property_free_pointers(prop);
|
RNA_def_property_free_pointers(prop);
|
||||||
rna_freelinkN(&cont->properties, prop);
|
rna_freelinkN(&cont->properties, prop);
|
||||||
|
@ -177,7 +177,7 @@ static GHash *id_weakref_pool_get(ID *id)
|
|||||||
if (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. */
|
/* we're using a ghash as a set, could use libHX's HXMAP_SINGULAR but would be an extra dep. */
|
||||||
weakinfo_hash = BLI_ghash_ptr_new("rna_id");
|
weakinfo_hash = BLI_ghash_ptr_new("rna_id");
|
||||||
BLI_ghash_insert(id_weakref_pool, (void *)id, weakinfo_hash);
|
BLI_ghash_insert(id_weakref_pool, id, weakinfo_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
return weakinfo_hash;
|
return weakinfo_hash;
|
||||||
@ -203,7 +203,7 @@ static void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna)
|
|||||||
Py_DECREF(weakref_cb_py); /* function owned by the weakref now */
|
Py_DECREF(weakref_cb_py); /* function owned by the weakref now */
|
||||||
|
|
||||||
/* important to add at the end, since first removal looks at the end */
|
/* important to add at the end, since first removal looks at the end */
|
||||||
BLI_ghash_insert(weakinfo_hash, (void *)weakref, id); /* using a hash table as a set, all 'id's are the same */
|
BLI_ghash_insert(weakinfo_hash, weakref, id); /* using a hash table as a set, all 'id's are the same */
|
||||||
/* weakinfo_hash owns the weakref */
|
/* weakinfo_hash owns the weakref */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ uiListType *WM_uilisttype_find(const char *idname, bool quiet)
|
|||||||
|
|
||||||
bool WM_uilisttype_add(uiListType *ult)
|
bool WM_uilisttype_add(uiListType *ult)
|
||||||
{
|
{
|
||||||
BLI_ghash_insert(uilisttypes_hash, (void *)ult->idname, ult);
|
BLI_ghash_insert(uilisttypes_hash, ult->idname, ult);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ MenuType *WM_menutype_find(const char *idname, bool quiet)
|
|||||||
|
|
||||||
bool WM_menutype_add(MenuType *mt)
|
bool WM_menutype_add(MenuType *mt)
|
||||||
{
|
{
|
||||||
BLI_ghash_insert(menutypes_hash, (void *)mt->idname, mt);
|
BLI_ghash_insert(menutypes_hash, mt->idname, mt);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ void WM_operatortype_remove_ptr(wmOperatorType *ot)
|
|||||||
if (ot->macro.first)
|
if (ot->macro.first)
|
||||||
wm_operatortype_free_macro(ot);
|
wm_operatortype_free_macro(ot);
|
||||||
|
|
||||||
BLI_ghash_remove(global_ops_hash, (void *)ot->idname, NULL, NULL);
|
BLI_ghash_remove(global_ops_hash, ot->idname, NULL, NULL);
|
||||||
|
|
||||||
WM_keyconfig_update_operatortype();
|
WM_keyconfig_update_operatortype();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user