Cleanup: use '_len' instead of '_size' w/ BLI API
- When returning the number of items in a collection use BLI_*_len() - Keep _size() for size in bytes. - Keep _count() for data structures that don't store length (hint this isn't a simple getter). See P611 to apply instead of manually resolving conflicts.
This commit is contained in:
parent
4da6c49613
commit
ccdacf1c9b
|
@ -411,7 +411,7 @@ static BVHTree *bvhtree_from_editmesh_verts_create_tree(
|
|||
BMVert *eve = BM_vert_at_index(em->bm, i);
|
||||
BLI_bvhtree_insert(tree, i, eve->co, 1);
|
||||
}
|
||||
BLI_assert(BLI_bvhtree_get_size(tree) == verts_num_active);
|
||||
BLI_assert(BLI_bvhtree_get_len(tree) == verts_num_active);
|
||||
BLI_bvhtree_balance(tree);
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ static BVHTree *bvhtree_from_mesh_verts_create_tree(
|
|||
}
|
||||
BLI_bvhtree_insert(tree, i, vert[i].co, 1);
|
||||
}
|
||||
BLI_assert(BLI_bvhtree_get_size(tree) == verts_num_active);
|
||||
BLI_assert(BLI_bvhtree_get_len(tree) == verts_num_active);
|
||||
BLI_bvhtree_balance(tree);
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ static BVHTree *bvhtree_from_editmesh_edges_create_tree(
|
|||
|
||||
BLI_bvhtree_insert(tree, i, co[0], 2);
|
||||
}
|
||||
BLI_assert(BLI_bvhtree_get_size(tree) == edges_num_active);
|
||||
BLI_assert(BLI_bvhtree_get_len(tree) == edges_num_active);
|
||||
BLI_bvhtree_balance(tree);
|
||||
}
|
||||
|
||||
|
@ -829,7 +829,7 @@ static BVHTree *bvhtree_from_mesh_faces_create_tree(
|
|||
BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
|
||||
}
|
||||
}
|
||||
BLI_assert(BLI_bvhtree_get_size(tree) == faces_num_active);
|
||||
BLI_assert(BLI_bvhtree_get_len(tree) == faces_num_active);
|
||||
BLI_bvhtree_balance(tree);
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ static BVHTree *bvhtree_from_editmesh_looptri_create_tree(
|
|||
}
|
||||
}
|
||||
}
|
||||
BLI_assert(BLI_bvhtree_get_size(tree) == looptri_num_active);
|
||||
BLI_assert(BLI_bvhtree_get_len(tree) == looptri_num_active);
|
||||
BLI_bvhtree_balance(tree);
|
||||
}
|
||||
}
|
||||
|
@ -1032,7 +1032,7 @@ static BVHTree *bvhtree_from_mesh_looptri_create_tree(
|
|||
BLI_bvhtree_insert(tree, i, co[0], 3);
|
||||
}
|
||||
}
|
||||
BLI_assert(BLI_bvhtree_get_size(tree) == looptri_num_active);
|
||||
BLI_assert(BLI_bvhtree_get_len(tree) == looptri_num_active);
|
||||
BLI_bvhtree_balance(tree);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3435,7 +3435,7 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm)
|
|||
}
|
||||
}
|
||||
|
||||
numEdges = BLI_edgeset_size(eh);
|
||||
numEdges = BLI_edgeset_len(eh);
|
||||
|
||||
/* write new edges into a temporary CustomData */
|
||||
CustomData_reset(&edgeData);
|
||||
|
@ -3504,7 +3504,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
|
|||
}
|
||||
}
|
||||
|
||||
numEdges = BLI_edgehash_size(eh);
|
||||
numEdges = BLI_edgehash_len(eh);
|
||||
|
||||
/* write new edges into a temporary CustomData */
|
||||
CustomData_reset(&edgeData);
|
||||
|
|
|
@ -210,7 +210,7 @@ static void colorband_init_from_table_rgba_resample(
|
|||
while ((carr_len > 1 && !BLI_heap_is_empty(heap)) &&
|
||||
((carr_len >= MAXCOLORBAND) || (BLI_heap_node_value(BLI_heap_top(heap)) <= eps_2x)))
|
||||
{
|
||||
c = BLI_heap_popmin(heap);
|
||||
c = BLI_heap_pop_min(heap);
|
||||
struct ColorResampleElem *c_next = c->next, *c_prev = c->prev;
|
||||
c_prev->next = c_next;
|
||||
c_next->prev = c_prev;
|
||||
|
|
|
@ -159,7 +159,7 @@ static void curve_decimate(
|
|||
struct Knot *k;
|
||||
|
||||
{
|
||||
struct Removal *r = BLI_heap_popmin(heap);
|
||||
struct Removal *r = BLI_heap_pop_min(heap);
|
||||
k = &knots[r->knot_index];
|
||||
k->heap_node = NULL;
|
||||
k->prev->handles[1] = r->handles[0];
|
||||
|
|
|
@ -2026,7 +2026,7 @@ void BKE_library_make_local(
|
|||
GSet *loop_tags = BLI_gset_ptr_new(__func__);
|
||||
for (LinkNode *it = todo_ids; it; it = it->next) {
|
||||
library_make_local_copying_check(it->link, loop_tags, bmain->relations, done_ids);
|
||||
BLI_assert(BLI_gset_size(loop_tags) == 0);
|
||||
BLI_assert(BLI_gset_len(loop_tags) == 0);
|
||||
}
|
||||
BLI_gset_free(loop_tags, NULL);
|
||||
BLI_gset_free(done_ids, NULL);
|
||||
|
|
|
@ -1003,7 +1003,7 @@ static void make_edges_mdata_extend(MEdge **r_alledge, int *r_totedge,
|
|||
BKE_mesh_poly_edgehash_insert(eh, mp, mloop + mp->loopstart);
|
||||
}
|
||||
|
||||
totedge_new = BLI_edgehash_size(eh);
|
||||
totedge_new = BLI_edgehash_len(eh);
|
||||
|
||||
#ifdef DEBUG
|
||||
/* ensure that theres no overlap! */
|
||||
|
|
|
@ -1486,7 +1486,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select)
|
|||
}
|
||||
}
|
||||
|
||||
totedge = BLI_edgehash_size(eh);
|
||||
totedge = BLI_edgehash_len(eh);
|
||||
|
||||
/* write new edges into a temporary CustomData */
|
||||
CustomData_reset(&edata);
|
||||
|
|
|
@ -2787,7 +2787,7 @@ int BKE_node_instance_hash_haskey(bNodeInstanceHash *hash, bNodeInstanceKey key)
|
|||
|
||||
int BKE_node_instance_hash_size(bNodeInstanceHash *hash)
|
||||
{
|
||||
return BLI_ghash_size(hash->ghash);
|
||||
return BLI_ghash_len(hash->ghash);
|
||||
}
|
||||
|
||||
void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash)
|
||||
|
|
|
@ -539,7 +539,7 @@ bool *BKE_object_defgroup_validmap_get(Object *ob, const int defbase_tot)
|
|||
BLI_ghash_insert(gh, dg->name, NULL);
|
||||
}
|
||||
|
||||
BLI_assert(BLI_ghash_size(gh) == defbase_tot);
|
||||
BLI_assert(BLI_ghash_len(gh) == defbase_tot);
|
||||
|
||||
/* now loop through the armature modifiers and identify deform bones */
|
||||
for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob, &virtualModifierData) : md->next) {
|
||||
|
@ -574,7 +574,7 @@ bool *BKE_object_defgroup_validmap_get(Object *ob, const int defbase_tot)
|
|||
defgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);
|
||||
}
|
||||
|
||||
BLI_assert(i == BLI_ghash_size(gh));
|
||||
BLI_assert(i == BLI_ghash_len(gh));
|
||||
|
||||
BLI_ghash_free(gh, NULL, NULL);
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ static void fill_treehash(void *treehash, BLI_mempool *treestore)
|
|||
|
||||
void *BKE_outliner_treehash_create_from_treestore(BLI_mempool *treestore)
|
||||
{
|
||||
GHash *treehash = BLI_ghash_new_ex(tse_hash, tse_cmp, "treehash", BLI_mempool_count(treestore));
|
||||
GHash *treehash = BLI_ghash_new_ex(tse_hash, tse_cmp, "treehash", BLI_mempool_len(treestore));
|
||||
fill_treehash(treehash, treestore);
|
||||
return treehash;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ void *BKE_outliner_treehash_rebuild_from_treestore(void *treehash, BLI_mempool *
|
|||
{
|
||||
BLI_assert(treehash);
|
||||
|
||||
BLI_ghash_clear_ex(treehash, NULL, free_treehash_group, BLI_mempool_count(treestore));
|
||||
BLI_ghash_clear_ex(treehash, NULL, free_treehash_group, BLI_mempool_len(treestore));
|
||||
fill_treehash(treehash, treestore);
|
||||
return treehash;
|
||||
}
|
||||
|
|
|
@ -1294,7 +1294,7 @@ void BKE_pbvh_get_grid_updates(PBVH *bvh, bool clear, void ***r_gridfaces, int *
|
|||
|
||||
pbvh_iter_end(&iter);
|
||||
|
||||
const int tot = BLI_gset_size(face_set);
|
||||
const int tot = BLI_gset_len(face_set);
|
||||
if (tot == 0) {
|
||||
*r_totface = 0;
|
||||
*r_gridfaces = NULL;
|
||||
|
@ -1433,8 +1433,8 @@ void BKE_pbvh_node_num_verts(
|
|||
if (r_uniquevert) *r_uniquevert = node->uniq_verts;
|
||||
break;
|
||||
case PBVH_BMESH:
|
||||
tot = BLI_gset_size(node->bm_unique_verts);
|
||||
if (r_totvert) *r_totvert = tot + BLI_gset_size(node->bm_other_verts);
|
||||
tot = BLI_gset_len(node->bm_unique_verts);
|
||||
if (r_totvert) *r_totvert = tot + BLI_gset_len(node->bm_other_verts);
|
||||
if (r_uniquevert) *r_uniquevert = tot;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde
|
|||
const int cd_face_node_offset = bvh->cd_face_node_offset;
|
||||
PBVHNode *n = &bvh->nodes[node_index];
|
||||
|
||||
if (BLI_gset_size(n->bm_faces) <= bvh->leaf_limit) {
|
||||
if (BLI_gset_len(n->bm_faces) <= bvh->leaf_limit) {
|
||||
/* Node limit not exceeded */
|
||||
pbvh_bmesh_node_finalize(bvh, node_index, cd_vert_node_offset, cd_face_node_offset);
|
||||
return;
|
||||
|
@ -289,8 +289,8 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde
|
|||
*c2 = &bvh->nodes[children + 1];
|
||||
c1->flag |= PBVH_Leaf;
|
||||
c2->flag |= PBVH_Leaf;
|
||||
c1->bm_faces = BLI_gset_ptr_new_ex("bm_faces", BLI_gset_size(n->bm_faces) / 2);
|
||||
c2->bm_faces = BLI_gset_ptr_new_ex("bm_faces", BLI_gset_size(n->bm_faces) / 2);
|
||||
c1->bm_faces = BLI_gset_ptr_new_ex("bm_faces", BLI_gset_len(n->bm_faces) / 2);
|
||||
c2->bm_faces = BLI_gset_ptr_new_ex("bm_faces", BLI_gset_len(n->bm_faces) / 2);
|
||||
|
||||
/* Partition the parent node's faces between the two children */
|
||||
GSET_ITER (gs_iter, n->bm_faces) {
|
||||
|
@ -305,11 +305,11 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde
|
|||
|
||||
/* Enforce at least one primitive in each node */
|
||||
GSet *empty = NULL, *other;
|
||||
if (BLI_gset_size(c1->bm_faces) == 0) {
|
||||
if (BLI_gset_len(c1->bm_faces) == 0) {
|
||||
empty = c1->bm_faces;
|
||||
other = c2->bm_faces;
|
||||
}
|
||||
else if (BLI_gset_size(c2->bm_faces) == 0) {
|
||||
else if (BLI_gset_len(c2->bm_faces) == 0) {
|
||||
empty = c2->bm_faces;
|
||||
other = c1->bm_faces;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde
|
|||
static bool pbvh_bmesh_node_limit_ensure(PBVH *bvh, int node_index)
|
||||
{
|
||||
GSet *bm_faces = bvh->nodes[node_index].bm_faces;
|
||||
const int bm_faces_size = BLI_gset_size(bm_faces);
|
||||
const int bm_faces_size = BLI_gset_len(bm_faces);
|
||||
if (bm_faces_size <= bvh->leaf_limit) {
|
||||
/* Node limit not exceeded */
|
||||
return false;
|
||||
|
@ -1238,7 +1238,7 @@ static bool pbvh_bmesh_subdivide_long_edges(
|
|||
bool any_subdivided = false;
|
||||
|
||||
while (!BLI_heap_is_empty(eq_ctx->q->heap)) {
|
||||
BMVert **pair = BLI_heap_popmin(eq_ctx->q->heap);
|
||||
BMVert **pair = BLI_heap_pop_min(eq_ctx->q->heap);
|
||||
BMVert *v1 = pair[0], *v2 = pair[1];
|
||||
BMEdge *e;
|
||||
|
||||
|
@ -1455,7 +1455,7 @@ static bool pbvh_bmesh_collapse_short_edges(
|
|||
GHash *deleted_verts = BLI_ghash_ptr_new("deleted_verts");
|
||||
|
||||
while (!BLI_heap_is_empty(eq_ctx->q->heap)) {
|
||||
BMVert **pair = BLI_heap_popmin(eq_ctx->q->heap);
|
||||
BMVert **pair = BLI_heap_pop_min(eq_ctx->q->heap);
|
||||
BMVert *v1 = pair[0], *v2 = pair[1];
|
||||
BLI_mempool_free(eq_ctx->pool, pair);
|
||||
pair = NULL;
|
||||
|
@ -2011,10 +2011,10 @@ void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node)
|
|||
if (node->bm_orco)
|
||||
return;
|
||||
|
||||
const int totvert = BLI_gset_size(node->bm_unique_verts) +
|
||||
BLI_gset_size(node->bm_other_verts);
|
||||
const int totvert = BLI_gset_len(node->bm_unique_verts) +
|
||||
BLI_gset_len(node->bm_other_verts);
|
||||
|
||||
const int tottri = BLI_gset_size(node->bm_faces);
|
||||
const int tottri = BLI_gset_len(node->bm_faces);
|
||||
|
||||
node->bm_orco = MEM_mallocN(sizeof(*node->bm_orco) * totvert, __func__);
|
||||
node->bm_ortri = MEM_mallocN(sizeof(*node->bm_ortri) * tottri, __func__);
|
||||
|
@ -2189,12 +2189,12 @@ static void pbvh_bmesh_verify(PBVH *bvh)
|
|||
int totface = 0, totvert = 0;
|
||||
for (int i = 0; i < bvh->totnode; i++) {
|
||||
PBVHNode *n = &bvh->nodes[i];
|
||||
totface += n->bm_faces ? BLI_gset_size(n->bm_faces) : 0;
|
||||
totvert += n->bm_unique_verts ? BLI_gset_size(n->bm_unique_verts) : 0;
|
||||
totface += n->bm_faces ? BLI_gset_len(n->bm_faces) : 0;
|
||||
totvert += n->bm_unique_verts ? BLI_gset_len(n->bm_unique_verts) : 0;
|
||||
}
|
||||
|
||||
BLI_assert(totface == BLI_gset_size(faces_all));
|
||||
BLI_assert(totvert == BLI_gset_size(verts_all));
|
||||
BLI_assert(totface == BLI_gset_len(faces_all));
|
||||
BLI_assert(totvert == BLI_gset_len(verts_all));
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ bool BLI_edgehash_remove(EdgeHash *eh, unsigned int v0, unsigned int
|
|||
|
||||
void *BLI_edgehash_popkey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgehash_size(EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgehash_len(EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP valfreefp,
|
||||
const unsigned int nentries_reserve);
|
||||
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp);
|
||||
|
@ -104,7 +104,7 @@ typedef struct EdgeSetIterator EdgeSetIterator;
|
|||
EdgeSet *BLI_edgeset_new_ex(const char *info,
|
||||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
EdgeSet *BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgeset_size(EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
|
||||
int BLI_edgeset_len(EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_edgeset_add(EdgeSet *es, unsigned int v0, unsigned int v1);
|
||||
void BLI_edgeset_insert(EdgeSet *es, unsigned int v0, unsigned int v1);
|
||||
bool BLI_edgeset_haskey(EdgeSet *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -110,7 +110,7 @@ void BLI_ghash_clear_ex(
|
|||
void *BLI_ghash_popkey(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_ghash_haskey(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_ghash_pop(GHash *gh, GHashIterState *state, void **r_key, void **r_val) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
unsigned int BLI_ghash_size(GHash *gh) ATTR_WARN_UNUSED_RESULT;
|
||||
unsigned int BLI_ghash_len(GHash *gh) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_ghash_flag_set(GHash *gh, unsigned int flag);
|
||||
void BLI_ghash_flag_clear(GHash *gh, unsigned int flag);
|
||||
|
||||
|
@ -261,7 +261,7 @@ GSet *BLI_gset_new_ex(
|
|||
const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
GSet *BLI_gset_copy(GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
|
||||
unsigned int BLI_gset_size(GSet *gs) ATTR_WARN_UNUSED_RESULT;
|
||||
unsigned int BLI_gset_len(GSet *gs) ATTR_WARN_UNUSED_RESULT;
|
||||
void BLI_gset_flag_set(GSet *gs, unsigned int flag);
|
||||
void BLI_gset_flag_clear(GSet *gs, unsigned int flag);
|
||||
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp);
|
||||
|
@ -309,8 +309,8 @@ BLI_INLINE bool BLI_gsetIterator_done(GSetIterator *gsi) { return BLI_ghashItera
|
|||
|
||||
/* For testing, debugging only */
|
||||
#ifdef GHASH_INTERNAL_API
|
||||
int BLI_ghash_buckets_size(GHash *gh);
|
||||
int BLI_gset_buckets_size(GSet *gs);
|
||||
int BLI_ghash_buckets_len(GHash *gh);
|
||||
int BLI_gset_buckets_len(GSet *gs);
|
||||
|
||||
double BLI_ghash_calc_quality_ex(
|
||||
GHash *gh, double *r_load, double *r_variance,
|
||||
|
|
|
@ -36,11 +36,11 @@ typedef struct _GSQueue GSQueue;
|
|||
|
||||
GSQueue *BLI_gsqueue_new(size_t elem_size);
|
||||
bool BLI_gsqueue_is_empty(GSQueue *gq);
|
||||
int BLI_gsqueue_size(GSQueue *gq);
|
||||
int BLI_gsqueue_len(GSQueue *gq);
|
||||
void BLI_gsqueue_peek(GSQueue *gq, void *r_item);
|
||||
void BLI_gsqueue_pop(GSQueue *gq, void *r_item);
|
||||
void BLI_gsqueue_push(GSQueue *gq, const void *item);
|
||||
void BLI_gsqueue_pushback(GSQueue *gq, const void *item);
|
||||
void BLI_gsqueue_push_back(GSQueue *gq, const void *item);
|
||||
void BLI_gsqueue_free(GSQueue *gq);
|
||||
|
||||
#endif /* __BLI_GSQUEUE_H__ */
|
||||
|
|
|
@ -41,9 +41,9 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL
|
|||
void BLI_heap_insert_or_update(Heap *heap, HeapNode **node_p, float value, void *ptr) ATTR_NONNULL(1, 2);
|
||||
void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1, 2);
|
||||
bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1);
|
||||
unsigned int BLI_heap_size(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
|
||||
unsigned int BLI_heap_len(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
|
||||
HeapNode *BLI_heap_top(const Heap *heap) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
|
||||
void *BLI_heap_popmin(Heap *heap) ATTR_NONNULL(1);
|
||||
void *BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1);
|
||||
void BLI_heap_node_value_update(Heap *heap, HeapNode *node, float value) ATTR_NONNULL(1, 2);
|
||||
void BLI_heap_node_value_update_ptr(Heap *heap, HeapNode *node, float value, void *ptr) ATTR_NONNULL(1, 2);
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap(
|
|||
const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot,
|
||||
BVHTree_OverlapCallback callback, void *userdata);
|
||||
|
||||
int BLI_bvhtree_get_size(const BVHTree *tree);
|
||||
int BLI_bvhtree_get_len(const BVHTree *tree);
|
||||
|
||||
float BLI_bvhtree_get_epsilon(const BVHTree *tree);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
} (void)0
|
||||
|
||||
#define BLI_LINKSTACK_SIZE(var) \
|
||||
BLI_mempool_count(var##_pool_)
|
||||
BLI_mempool_len(var##_pool_)
|
||||
|
||||
/* check for typeof() */
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -53,7 +53,7 @@ void BLI_mempool_clear_ex(BLI_mempool *pool,
|
|||
const int totelem_reserve) ATTR_NONNULL(1);
|
||||
void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1);
|
||||
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1);
|
||||
int BLI_mempool_count(BLI_mempool *pool) ATTR_NONNULL(1);
|
||||
int BLI_mempool_len(BLI_mempool *pool) ATTR_NONNULL(1);
|
||||
void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
|
||||
|
||||
void BLI_mempool_as_table(BLI_mempool *pool, void **data) ATTR_NONNULL(1, 2);
|
||||
|
|
|
@ -66,7 +66,7 @@ bool BLI_smallhash_remove(SmallHash *sh, uintptr_t key) ATTR_NONNULL(1);
|
|||
void *BLI_smallhash_lookup(const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
void **BLI_smallhash_lookup_p(const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
bool BLI_smallhash_haskey(const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1);
|
||||
int BLI_smallhash_count(const SmallHash *sh) ATTR_NONNULL(1);
|
||||
int BLI_smallhash_len(const SmallHash *sh) ATTR_NONNULL(1);
|
||||
void *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
void **BLI_smallhash_iternext_p(SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
void *BLI_smallhash_iternew(const SmallHash *sh, SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
|
|
|
@ -177,7 +177,7 @@ void BLI_thread_queue_free(ThreadQueue *queue);
|
|||
void BLI_thread_queue_push(ThreadQueue *queue, void *work);
|
||||
void *BLI_thread_queue_pop(ThreadQueue *queue);
|
||||
void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms);
|
||||
int BLI_thread_queue_size(ThreadQueue *queue);
|
||||
int BLI_thread_queue_len(ThreadQueue *queue);
|
||||
bool BLI_thread_queue_is_empty(ThreadQueue *queue);
|
||||
|
||||
void BLI_thread_queue_wait_finish(ThreadQueue *queue);
|
||||
|
|
|
@ -741,7 +741,7 @@ void BLI_ghash_reserve(GHash *gh, const uint nentries_reserve)
|
|||
/**
|
||||
* \return size of the GHash.
|
||||
*/
|
||||
uint BLI_ghash_size(GHash *gh)
|
||||
uint BLI_ghash_len(GHash *gh)
|
||||
{
|
||||
return gh->nentries;
|
||||
}
|
||||
|
@ -1010,7 +1010,7 @@ void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfree
|
|||
*/
|
||||
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
|
||||
{
|
||||
BLI_assert((int)gh->nentries == BLI_mempool_count(gh->entrypool));
|
||||
BLI_assert((int)gh->nentries == BLI_mempool_len(gh->entrypool));
|
||||
if (keyfreefp || valfreefp)
|
||||
ghash_free_cb(gh, keyfreefp, valfreefp);
|
||||
|
||||
|
@ -1044,7 +1044,7 @@ void BLI_ghash_flag_clear(GHash *gh, uint flag)
|
|||
/**
|
||||
* Create a new GHashIterator. The hash table must not be mutated
|
||||
* while the iterator is in use, and the iterator will step exactly
|
||||
* BLI_ghash_size(gh) times before becoming done.
|
||||
* BLI_ghash_len(gh) times before becoming done.
|
||||
*
|
||||
* \param gh The GHash to iterate over.
|
||||
* \return Pointer to a new DynStr.
|
||||
|
@ -1059,7 +1059,7 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh)
|
|||
/**
|
||||
* Init an already allocated GHashIterator. The hash table must not
|
||||
* be mutated while the iterator is in use, and the iterator will
|
||||
* step exactly BLI_ghash_size(gh) times before becoming done.
|
||||
* step exactly BLI_ghash_len(gh) times before becoming done.
|
||||
*
|
||||
* \param ghi The GHashIterator to initialize.
|
||||
* \param gh The GHash to iterate over.
|
||||
|
@ -1398,7 +1398,7 @@ GSet *BLI_gset_copy(GSet *gs, GHashKeyCopyFP keycopyfp)
|
|||
return (GSet *)ghash_copy((GHash *)gs, keycopyfp, NULL);
|
||||
}
|
||||
|
||||
uint BLI_gset_size(GSet *gs)
|
||||
uint BLI_gset_len(GSet *gs)
|
||||
{
|
||||
return ((GHash *)gs)->nentries;
|
||||
}
|
||||
|
@ -1618,13 +1618,13 @@ GSet *BLI_gset_pair_new(const char *info)
|
|||
/**
|
||||
* \return number of buckets in the GHash.
|
||||
*/
|
||||
int BLI_ghash_buckets_size(GHash *gh)
|
||||
int BLI_ghash_buckets_len(GHash *gh)
|
||||
{
|
||||
return (int)gh->nbuckets;
|
||||
}
|
||||
int BLI_gset_buckets_size(GSet *gs)
|
||||
int BLI_gset_buckets_len(GSet *gs)
|
||||
{
|
||||
return BLI_ghash_buckets_size((GHash *)gs);
|
||||
return BLI_ghash_buckets_len((GHash *)gs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -303,7 +303,7 @@ bool BLI_heap_is_empty(const Heap *heap)
|
|||
return (heap->size == 0);
|
||||
}
|
||||
|
||||
uint BLI_heap_size(const Heap *heap)
|
||||
uint BLI_heap_len(const Heap *heap)
|
||||
{
|
||||
return heap->size;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ HeapNode *BLI_heap_top(const Heap *heap)
|
|||
/**
|
||||
* Pop the top node off the heap and return it's pointer.
|
||||
*/
|
||||
void *BLI_heap_popmin(Heap *heap)
|
||||
void *BLI_heap_pop_min(Heap *heap)
|
||||
{
|
||||
BLI_assert(heap->size != 0);
|
||||
|
||||
|
@ -348,7 +348,7 @@ void BLI_heap_remove(Heap *heap, HeapNode *node)
|
|||
i = p;
|
||||
}
|
||||
|
||||
BLI_heap_popmin(heap);
|
||||
BLI_heap_pop_min(heap);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1147,7 +1147,7 @@ void BLI_bvhtree_update_tree(BVHTree *tree)
|
|||
* Number of times #BLI_bvhtree_insert has been called.
|
||||
* mainly useful for asserts functions to check we added the correct number.
|
||||
*/
|
||||
int BLI_bvhtree_get_size(const BVHTree *tree)
|
||||
int BLI_bvhtree_get_len(const BVHTree *tree)
|
||||
{
|
||||
return tree->totleaf;
|
||||
}
|
||||
|
|
|
@ -474,7 +474,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
|
|||
}
|
||||
}
|
||||
|
||||
int BLI_mempool_count(BLI_mempool *pool)
|
||||
int BLI_mempool_len(BLI_mempool *pool)
|
||||
{
|
||||
return (int)pool->totused;
|
||||
}
|
||||
|
|
|
@ -1759,7 +1759,7 @@ bool BLI_array_store_is_valid(
|
|||
goto user_finally;
|
||||
}
|
||||
}
|
||||
if (!(BLI_mempool_count(bs->memory.chunk_list) == (int)BLI_ghash_size(chunk_list_map))) {
|
||||
if (!(BLI_mempool_len(bs->memory.chunk_list) == (int)BLI_ghash_len(chunk_list_map))) {
|
||||
ok = false;
|
||||
goto user_finally;
|
||||
}
|
||||
|
@ -1772,11 +1772,11 @@ bool BLI_array_store_is_valid(
|
|||
totrefs += 1;
|
||||
}
|
||||
}
|
||||
if (!(BLI_mempool_count(bs->memory.chunk) == (int)BLI_ghash_size(chunk_map))) {
|
||||
if (!(BLI_mempool_len(bs->memory.chunk) == (int)BLI_ghash_len(chunk_map))) {
|
||||
ok = false;
|
||||
goto user_finally;
|
||||
}
|
||||
if (!(BLI_mempool_count(bs->memory.chunk_ref) == totrefs)) {
|
||||
if (!(BLI_mempool_len(bs->memory.chunk_ref) == totrefs)) {
|
||||
ok = false;
|
||||
goto user_finally;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ bool BLI_astar_graph_solve(
|
|||
SET_INT_IN_POINTER(node_index_src));
|
||||
|
||||
while (!BLI_heap_is_empty(todo_nodes)) {
|
||||
const int node_curr_idx = GET_INT_FROM_POINTER(BLI_heap_popmin(todo_nodes));
|
||||
const int node_curr_idx = GET_INT_FROM_POINTER(BLI_heap_pop_min(todo_nodes));
|
||||
BLI_AStarGNode *node_curr = &as_graph->nodes[node_curr_idx];
|
||||
LinkData *ld;
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ bool BLI_edgehash_haskey(EdgeHash *eh, uint v0, uint v1)
|
|||
/**
|
||||
* Return number of keys in hash.
|
||||
*/
|
||||
int BLI_edgehash_size(EdgeHash *eh)
|
||||
int BLI_edgehash_len(EdgeHash *eh)
|
||||
{
|
||||
return (int)eh->nentries;
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp)
|
|||
|
||||
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp)
|
||||
{
|
||||
BLI_assert((int)eh->nentries == BLI_mempool_count(eh->epool));
|
||||
BLI_assert((int)eh->nentries == BLI_mempool_len(eh->epool));
|
||||
|
||||
if (valfreefp)
|
||||
edgehash_free_cb(eh, valfreefp);
|
||||
|
@ -599,7 +599,7 @@ void BLI_edgehash_flag_clear(EdgeHash *eh, uint flag)
|
|||
/**
|
||||
* Create a new EdgeHashIterator. The hash table must not be mutated
|
||||
* while the iterator is in use, and the iterator will step exactly
|
||||
* BLI_edgehash_size(eh) times before becoming done.
|
||||
* BLI_edgehash_len(eh) times before becoming done.
|
||||
*/
|
||||
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh)
|
||||
{
|
||||
|
@ -611,7 +611,7 @@ EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh)
|
|||
/**
|
||||
* Init an already allocated EdgeHashIterator. The hash table must not
|
||||
* be mutated while the iterator is in use, and the iterator will
|
||||
* step exactly BLI_edgehash_size(eh) times before becoming done.
|
||||
* step exactly BLI_edgehash_len(eh) times before becoming done.
|
||||
*
|
||||
* \param ehi The EdgeHashIterator to initialize.
|
||||
* \param eh The EdgeHash to iterate over.
|
||||
|
@ -729,7 +729,7 @@ EdgeSet *BLI_edgeset_new(const char *info)
|
|||
return BLI_edgeset_new_ex(info, 0);
|
||||
}
|
||||
|
||||
int BLI_edgeset_size(EdgeSet *es)
|
||||
int BLI_edgeset_len(EdgeSet *es)
|
||||
{
|
||||
return (int)((EdgeHash *)es)->nentries;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ bool BLI_gsqueue_is_empty(GSQueue *gq)
|
|||
/**
|
||||
* Query number elements in the queue
|
||||
*/
|
||||
int BLI_gsqueue_size(GSQueue *gq)
|
||||
int BLI_gsqueue_len(GSQueue *gq)
|
||||
{
|
||||
GSQueueElem *elem;
|
||||
int size = 0;
|
||||
|
@ -162,7 +162,7 @@ void BLI_gsqueue_push(GSQueue *gq, const void *item)
|
|||
* \param item A pointer to an appropriately
|
||||
* sized structure (the size passed to BLI_gsqueue_new).
|
||||
*/
|
||||
void BLI_gsqueue_pushback(GSQueue *gq, const void *item)
|
||||
void BLI_gsqueue_push_back(GSQueue *gq, const void *item)
|
||||
{
|
||||
GSQueueElem *elem = MEM_mallocN(sizeof(*elem) + gq->elem_size, "gqueue_push");
|
||||
memcpy(elem->data, item, gq->elem_size);
|
||||
|
|
|
@ -401,7 +401,7 @@ void BLI_polyfill_beautify(
|
|||
}
|
||||
|
||||
while (BLI_heap_is_empty(eheap) == false) {
|
||||
struct HalfEdge *e = BLI_heap_popmin(eheap);
|
||||
struct HalfEdge *e = BLI_heap_pop_min(eheap);
|
||||
eheap_table[e->base_index] = NULL;
|
||||
|
||||
polyedge_rotate(half_edges, e);
|
||||
|
|
|
@ -310,7 +310,7 @@ bool BLI_smallhash_haskey(const SmallHash *sh, uintptr_t key)
|
|||
return (e != NULL);
|
||||
}
|
||||
|
||||
int BLI_smallhash_count(const SmallHash *sh)
|
||||
int BLI_smallhash_len(const SmallHash *sh)
|
||||
{
|
||||
return (int)sh->nentries;
|
||||
}
|
||||
|
|
|
@ -1329,7 +1329,7 @@ void BLI_task_parallel_mempool(
|
|||
ParallelMempoolState state;
|
||||
int i, num_threads, num_tasks;
|
||||
|
||||
if (BLI_mempool_count(mempool) == 0) {
|
||||
if (BLI_mempool_len(mempool) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -773,12 +773,12 @@ void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
|
|||
return work;
|
||||
}
|
||||
|
||||
int BLI_thread_queue_size(ThreadQueue *queue)
|
||||
int BLI_thread_queue_len(ThreadQueue *queue)
|
||||
{
|
||||
int size;
|
||||
|
||||
pthread_mutex_lock(&queue->mutex);
|
||||
size = BLI_gsqueue_size(queue->queue);
|
||||
size = BLI_gsqueue_len(queue->queue);
|
||||
pthread_mutex_unlock(&queue->mutex);
|
||||
|
||||
return size;
|
||||
|
|
|
@ -2826,7 +2826,7 @@ static void write_soops(WriteData *wd, SpaceOops *so)
|
|||
if (ts) {
|
||||
SpaceOops so_flat = *so;
|
||||
|
||||
int elems = BLI_mempool_count(ts);
|
||||
int elems = BLI_mempool_len(ts);
|
||||
/* linearize mempool to array */
|
||||
TreeStoreElem *data = elems ? BLI_mempool_as_arrayN(ts, "TreeStoreElem") : NULL;
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ typedef struct Offset {
|
|||
/* Return the generated binary output. */
|
||||
static char *generate(GHash *messages, size_t *r_output_size)
|
||||
{
|
||||
const uint32_t num_keys = BLI_ghash_size(messages);
|
||||
const uint32_t num_keys = BLI_ghash_len(messages);
|
||||
|
||||
/* Get list of sorted keys. */
|
||||
char **keys = get_keys_sorted(messages, num_keys);
|
||||
|
|
|
@ -430,7 +430,7 @@ int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const
|
|||
void bmiter__elem_of_mesh_begin(struct BMIter__elem_of_mesh *iter)
|
||||
{
|
||||
#ifdef USE_IMMUTABLE_ASSERT
|
||||
((BMIter *)iter)->count = BLI_mempool_count(iter->pooliter.pool);
|
||||
((BMIter *)iter)->count = BLI_mempool_len(iter->pooliter.pool);
|
||||
#endif
|
||||
BLI_mempool_iternew(iter->pooliter.pool, &iter->pooliter);
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ void bmiter__elem_of_mesh_begin(struct BMIter__elem_of_mesh *iter)
|
|||
void *bmiter__elem_of_mesh_step(struct BMIter__elem_of_mesh *iter)
|
||||
{
|
||||
#ifdef USE_IMMUTABLE_ASSERT
|
||||
BLI_assert(((BMIter *)iter)->count <= BLI_mempool_count(iter->pooliter.pool));
|
||||
BLI_assert(((BMIter *)iter)->count <= BLI_mempool_len(iter->pooliter.pool));
|
||||
#endif
|
||||
return BLI_mempool_iterstep(&iter->pooliter);
|
||||
}
|
||||
|
|
|
@ -990,11 +990,11 @@ void BM_log_all_added(BMesh *bm, BMLog *log)
|
|||
BMFace *f;
|
||||
|
||||
/* avoid unnecessary resizing on initialization */
|
||||
if (BLI_ghash_size(log->current_entry->added_verts) == 0) {
|
||||
if (BLI_ghash_len(log->current_entry->added_verts) == 0) {
|
||||
BLI_ghash_reserve(log->current_entry->added_verts, (uint)bm->totvert);
|
||||
}
|
||||
|
||||
if (BLI_ghash_size(log->current_entry->added_faces) == 0) {
|
||||
if (BLI_ghash_len(log->current_entry->added_faces) == 0) {
|
||||
BLI_ghash_reserve(log->current_entry->added_faces, (uint)bm->totface);
|
||||
}
|
||||
|
||||
|
|
|
@ -673,7 +673,7 @@ int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
|
|||
{
|
||||
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
|
||||
return BLI_ghash_size(slot->data.ghash);
|
||||
return BLI_ghash_len(slot->data.ghash);
|
||||
}
|
||||
|
||||
/* inserts a key/value mapping into a mapping slot. note that it copies the
|
||||
|
|
|
@ -662,11 +662,11 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op)
|
|||
while (!BLI_heap_is_empty(pc.states)) {
|
||||
|
||||
#ifdef DEBUG_PRINT
|
||||
printf("\n%s: stepping %u\n", __func__, BLI_heap_size(pc.states));
|
||||
printf("\n%s: stepping %u\n", __func__, BLI_heap_len(pc.states));
|
||||
#endif
|
||||
|
||||
while (!BLI_heap_is_empty(pc.states)) {
|
||||
PathLinkState *state = BLI_heap_popmin(pc.states);
|
||||
PathLinkState *state = BLI_heap_pop_min(pc.states);
|
||||
|
||||
/* either we insert this into 'pc.states' or its freed */
|
||||
bool continue_search;
|
||||
|
|
|
@ -180,7 +180,7 @@ static void bm_rotate_edges_shared(
|
|||
|
||||
const int edges_len_rotate_prev = edges_len_rotate;
|
||||
while (!BLI_heap_is_empty(heap)) {
|
||||
BMEdge *e_best = BLI_heap_popmin(heap);
|
||||
BMEdge *e_best = BLI_heap_pop_min(heap);
|
||||
eheap_table[BM_elem_index_get(e_best)] = NULL;
|
||||
|
||||
/* No problem if this fails, re-evaluate if faces connected to this edge are touched. */
|
||||
|
|
|
@ -269,7 +269,7 @@ static GSet *bm_edgering_pair_calc(BMesh *bm, ListBase *eloops_rim)
|
|||
|
||||
BLI_ghash_free(vert_eloop_gh, NULL, NULL);
|
||||
|
||||
if (BLI_gset_size(eloop_pair_gs) == 0) {
|
||||
if (BLI_gset_len(eloop_pair_gs) == 0) {
|
||||
BLI_gset_free(eloop_pair_gs, NULL);
|
||||
eloop_pair_gs = NULL;
|
||||
}
|
||||
|
@ -1193,7 +1193,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
lpair_arr = BLI_array_alloca(lpair_arr, BLI_gset_size(eloop_pairs_gs));
|
||||
lpair_arr = BLI_array_alloca(lpair_arr, BLI_gset_len(eloop_pairs_gs));
|
||||
|
||||
/* first cache pairs */
|
||||
GSET_ITER_INDEX (gs_iter, eloop_pairs_gs, i) {
|
||||
|
|
|
@ -106,7 +106,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
|
|||
/* sf_edge = */ BLI_scanfill_edge_add(&sf_ctx, UNPACK2(sf_verts));
|
||||
/* sf_edge->tmp.p = e; */ /* UNUSED */
|
||||
}
|
||||
nors_tot = BLI_ghash_size(sf_vert_map);
|
||||
nors_tot = BLI_ghash_len(sf_vert_map);
|
||||
BLI_ghash_free(sf_vert_map, NULL, NULL);
|
||||
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ void BM_mesh_beautify_fill(
|
|||
bm->elem_index_dirty |= BM_EDGE;
|
||||
|
||||
while (BLI_heap_is_empty(eheap) == false) {
|
||||
BMEdge *e = BLI_heap_popmin(eheap);
|
||||
BMEdge *e = BLI_heap_pop_min(eheap);
|
||||
i = BM_elem_index_get(e);
|
||||
eheap_table[i] = NULL;
|
||||
|
||||
|
|
|
@ -1357,7 +1357,7 @@ void BM_mesh_decimate_collapse(
|
|||
(BLI_heap_node_value(BLI_heap_top(eheap)) != COST_INVALID))
|
||||
{
|
||||
// const float value = BLI_heap_node_value(BLI_heap_top(eheap));
|
||||
BMEdge *e = BLI_heap_popmin(eheap);
|
||||
BMEdge *e = BLI_heap_pop_min(eheap);
|
||||
float optimize_co[3];
|
||||
BLI_assert(BM_elem_index_get(e) < tot_edge_orig); /* handy to detect corruptions elsewhere */
|
||||
|
||||
|
@ -1388,7 +1388,7 @@ void BM_mesh_decimate_collapse(
|
|||
* - edges sharing a vertex are ignored, so the pivot vertex isnt moved to one side.
|
||||
*/
|
||||
|
||||
BMEdge *e = BLI_heap_popmin(eheap);
|
||||
BMEdge *e = BLI_heap_pop_min(eheap);
|
||||
const int e_index = BM_elem_index_get(e);
|
||||
const int e_index_mirr = edge_symmetry_map[e_index];
|
||||
BMEdge *e_mirr = NULL;
|
||||
|
|
|
@ -335,7 +335,7 @@ static LinkNode *bm_edgenet_path_calc(
|
|||
BLI_linklist_free_pool(v_ls_next, NULL, path_pool);
|
||||
BLI_linklist_free_pool(v_ls_prev, NULL, path_pool);
|
||||
|
||||
// BLI_assert(BLI_mempool_count(path_pool) == 0);
|
||||
// BLI_assert(BLI_mempool_len(path_pool) == 0);
|
||||
|
||||
path_len = bm_edgenet_path_from_pass(e_found->v1, &path, vnet_info, path_pool);
|
||||
BLI_linklist_reverse(&path);
|
||||
|
@ -505,7 +505,7 @@ void BM_mesh_edgenet(
|
|||
}
|
||||
|
||||
BLI_linklist_free_pool(path, NULL, path_pool);
|
||||
BLI_assert(BLI_mempool_count(path_pool) == 0);
|
||||
BLI_assert(BLI_mempool_len(path_pool) == 0);
|
||||
}
|
||||
|
||||
bm->elem_index_dirty |= BM_FACE | BM_LOOP;
|
||||
|
|
|
@ -1275,8 +1275,8 @@ bool BM_mesh_intersect(
|
|||
}
|
||||
}
|
||||
|
||||
splice_ls = MEM_mallocN(BLI_gset_size(s.wire_edges) * sizeof(*splice_ls), __func__);
|
||||
STACK_INIT(splice_ls, BLI_gset_size(s.wire_edges));
|
||||
splice_ls = MEM_mallocN(BLI_gset_len(s.wire_edges) * sizeof(*splice_ls), __func__);
|
||||
STACK_INIT(splice_ls, BLI_gset_len(s.wire_edges));
|
||||
|
||||
for (node = s.vert_dissolve; node; node = node->next) {
|
||||
BMEdge *e_pair[2];
|
||||
|
@ -1690,7 +1690,7 @@ bool BM_mesh_intersect(
|
|||
}
|
||||
}
|
||||
|
||||
has_edit_isect = (BLI_ghash_size(s.face_edges) != 0);
|
||||
has_edit_isect = (BLI_ghash_len(s.face_edges) != 0);
|
||||
|
||||
/* cleanup */
|
||||
BLI_ghash_free(s.edgetri_cache, NULL, NULL);
|
||||
|
|
|
@ -174,7 +174,7 @@ LinkNode *BM_mesh_calc_path_vert(
|
|||
cost[BM_elem_index_get(v_src)] = 0.0f;
|
||||
|
||||
while (!BLI_heap_is_empty(heap)) {
|
||||
v = BLI_heap_popmin(heap);
|
||||
v = BLI_heap_pop_min(heap);
|
||||
|
||||
if (v == v_dst)
|
||||
break;
|
||||
|
@ -346,7 +346,7 @@ LinkNode *BM_mesh_calc_path_edge(
|
|||
cost[BM_elem_index_get(e_src)] = 0.0f;
|
||||
|
||||
while (!BLI_heap_is_empty(heap)) {
|
||||
e = BLI_heap_popmin(heap);
|
||||
e = BLI_heap_pop_min(heap);
|
||||
|
||||
if (e == e_dst)
|
||||
break;
|
||||
|
@ -532,7 +532,7 @@ LinkNode *BM_mesh_calc_path_face(
|
|||
cost[BM_elem_index_get(f_src)] = 0.0f;
|
||||
|
||||
while (!BLI_heap_is_empty(heap)) {
|
||||
f = BLI_heap_popmin(heap);
|
||||
f = BLI_heap_pop_min(heap);
|
||||
|
||||
if (f == f_dst)
|
||||
break;
|
||||
|
|
|
@ -421,8 +421,8 @@ static void bm_uuidwalk_rehash(
|
|||
UUID_Int *uuid_store;
|
||||
uint i;
|
||||
|
||||
uint rehash_store_len_new = MAX2(BLI_ghash_size(uuidwalk->verts_uuid),
|
||||
BLI_ghash_size(uuidwalk->faces_uuid));
|
||||
uint rehash_store_len_new = MAX2(BLI_ghash_len(uuidwalk->verts_uuid),
|
||||
BLI_ghash_len(uuidwalk->faces_uuid));
|
||||
|
||||
bm_uuidwalk_rehash_reserve(uuidwalk, rehash_store_len_new);
|
||||
uuid_store = uuidwalk->cache.rehash_store;
|
||||
|
@ -520,8 +520,8 @@ static void bm_uuidwalk_pass_add(
|
|||
verts_uuid_pass = uuidwalk->cache.verts_uuid;
|
||||
faces_step_next = uuidwalk->cache.faces_step;
|
||||
|
||||
BLI_assert(BLI_ghash_size(verts_uuid_pass) == 0);
|
||||
BLI_assert(BLI_gset_size(faces_step_next) == 0);
|
||||
BLI_assert(BLI_ghash_len(verts_uuid_pass) == 0);
|
||||
BLI_assert(BLI_gset_len(faces_step_next) == 0);
|
||||
|
||||
/* Add the face_step data from connected faces, creating new passes */
|
||||
fstep = BLI_mempool_alloc(uuidwalk->step_pool);
|
||||
|
@ -659,7 +659,7 @@ static bool bm_uuidwalk_facestep_begin(
|
|||
LinkNode *f_link, *f_link_next, **f_link_prev_p;
|
||||
bool ok = false;
|
||||
|
||||
BLI_assert(BLI_ghash_size(uuidwalk->cache.faces_from_uuid) == 0);
|
||||
BLI_assert(BLI_ghash_len(uuidwalk->cache.faces_from_uuid) == 0);
|
||||
BLI_assert(BLI_listbase_is_empty(&fstep->items));
|
||||
|
||||
f_link_prev_p = &fstep->faces;
|
||||
|
@ -864,7 +864,7 @@ static BMFace **bm_mesh_region_match_pair(
|
|||
break;
|
||||
}
|
||||
|
||||
found = (BLI_ghash_size(w_dst->faces_uuid) == faces_src_region_len);
|
||||
found = (BLI_ghash_len(w_dst->faces_uuid) == faces_src_region_len);
|
||||
if (found) {
|
||||
break;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ static BMFace **bm_mesh_region_match_pair(
|
|||
|
||||
if (found) {
|
||||
GHashIterator gh_iter;
|
||||
const uint faces_result_len = BLI_ghash_size(w_dst->faces_uuid);
|
||||
const uint faces_result_len = BLI_ghash_len(w_dst->faces_uuid);
|
||||
uint i;
|
||||
|
||||
faces_result = MEM_mallocN(sizeof(*faces_result) * (faces_result_len + 1), __func__);
|
||||
|
|
|
@ -355,7 +355,7 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
|
|||
case DEG_NODE_TYPE_ID_REF:
|
||||
{
|
||||
const IDDepsNode *id_node = (const IDDepsNode *)node;
|
||||
if (BLI_ghash_size(id_node->components) == 0) {
|
||||
if (BLI_ghash_len(id_node->components) == 0) {
|
||||
deg_debug_graphviz_node_single(ctx, node);
|
||||
}
|
||||
else {
|
||||
|
@ -406,7 +406,7 @@ static bool deg_debug_graphviz_is_cluster(const DepsNode *node)
|
|||
case DEG_NODE_TYPE_ID_REF:
|
||||
{
|
||||
const IDDepsNode *id_node = (const IDDepsNode *)node;
|
||||
return BLI_ghash_size(id_node->components) > 0;
|
||||
return BLI_ghash_len(id_node->components) > 0;
|
||||
}
|
||||
case DEG_NODE_TYPE_PARAMETERS:
|
||||
case DEG_NODE_TYPE_ANIMATION:
|
||||
|
|
|
@ -155,5 +155,5 @@ void DEG_evaluate_on_framechange(EvaluationContext *eval_ctx,
|
|||
bool DEG_needs_eval(Depsgraph *graph)
|
||||
{
|
||||
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
|
||||
return BLI_gset_size(deg_graph->entry_tags) != 0;
|
||||
return BLI_gset_len(deg_graph->entry_tags) != 0;
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
|
|||
const unsigned int layers)
|
||||
{
|
||||
/* Nothing to update, early out. */
|
||||
if (BLI_gset_size(graph->entry_tags) == 0) {
|
||||
if (BLI_gset_len(graph->entry_tags) == 0) {
|
||||
return;
|
||||
}
|
||||
DEG_DEBUG_PRINTF("%s: layers:%u, graph->layers:%u\n",
|
||||
|
|
|
@ -264,7 +264,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
|
|||
BLI_assert(bmain != NULL);
|
||||
BLI_assert(graph != NULL);
|
||||
/* Nothing to update, early out. */
|
||||
if (BLI_gset_size(graph->entry_tags) == 0) {
|
||||
if (BLI_gset_len(graph->entry_tags) == 0) {
|
||||
return;
|
||||
}
|
||||
/* Reset all flags, get ready for the flush. */
|
||||
|
|
|
@ -305,7 +305,7 @@ OperationDepsNode *ComponentDepsNode::get_entry_operation()
|
|||
if (entry_operation) {
|
||||
return entry_operation;
|
||||
}
|
||||
else if (operations_map != NULL && BLI_ghash_size(operations_map) == 1) {
|
||||
else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
|
||||
OperationDepsNode *op_node = NULL;
|
||||
/* TODO(sergey): This is somewhat slow. */
|
||||
GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
|
||||
|
@ -328,7 +328,7 @@ OperationDepsNode *ComponentDepsNode::get_exit_operation()
|
|||
if (exit_operation) {
|
||||
return exit_operation;
|
||||
}
|
||||
else if (operations_map != NULL && BLI_ghash_size(operations_map) == 1) {
|
||||
else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
|
||||
OperationDepsNode *op_node = NULL;
|
||||
/* TODO(sergey): This is somewhat slow. */
|
||||
GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
|
||||
|
@ -348,7 +348,7 @@ OperationDepsNode *ComponentDepsNode::get_exit_operation()
|
|||
|
||||
void ComponentDepsNode::finalize_build()
|
||||
{
|
||||
operations.reserve(BLI_ghash_size(operations_map));
|
||||
operations.reserve(BLI_ghash_len(operations_map));
|
||||
GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, operations_map)
|
||||
{
|
||||
operations.push_back(op_node);
|
||||
|
|
|
@ -172,7 +172,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C))
|
|||
GHashIterator ghi;
|
||||
const char *menu_header = IFACE_("Template %t|None %x0|");
|
||||
char *p;
|
||||
const size_t template_size = (BLI_ghash_size(TEMPLATES_HASH) * 32 + 30);
|
||||
const size_t template_size = (BLI_ghash_len(TEMPLATES_HASH) * 32 + 30);
|
||||
|
||||
if (TEMPLATES_MENU != NULL) {
|
||||
MEM_freeN(TEMPLATES_MENU);
|
||||
|
|
|
@ -546,7 +546,7 @@ void verifyFaces(ReebGraph *rg)
|
|||
int total = 0;
|
||||
ReebArc *arc = NULL;
|
||||
for (arc = rg->arcs.first; arc; arc = arc->next) {
|
||||
total += BLI_ghash_size(arc->faces);
|
||||
total += BLI_ghash_len(arc->faces);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1656,7 +1656,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
|
|||
{
|
||||
GHashIterator ghi;
|
||||
int merging = 0;
|
||||
int total = BLI_ghash_size(arc->faces);
|
||||
int total = BLI_ghash_len(arc->faces);
|
||||
float avg_angle = 0;
|
||||
float avg_vec[3] = {0, 0, 0};
|
||||
|
||||
|
@ -1932,7 +1932,7 @@ void REEB_exportGraph(ReebGraph *rg, int count)
|
|||
add_v3_v3v3(p, arc->tail->p, arc->head->p);
|
||||
mul_v3_fl(p, 0.5f);
|
||||
|
||||
fprintf(f, "angle %0.3f %0.3f %0.3f %0.3f %i\n", p[0], p[1], p[2], arc->angle, BLI_ghash_size(arc->faces));
|
||||
fprintf(f, "angle %0.3f %0.3f %0.3f %0.3f %i\n", p[0], p[1], p[2], arc->angle, BLI_ghash_len(arc->faces));
|
||||
exportNode(f, "v2", arc->tail);
|
||||
}
|
||||
|
||||
|
@ -2678,7 +2678,7 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
|
|||
eed->f1 = 0;
|
||||
}
|
||||
|
||||
while (BLI_heap_size(edge_heap) > 0) {
|
||||
while (BLI_heap_len(edge_heap) > 0) {
|
||||
float current_weight;
|
||||
|
||||
current_eve->f1 = 1; /* mark vertex as selected */
|
||||
|
@ -2695,7 +2695,7 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
|
|||
/* Find next shortest edge with unselected verts */
|
||||
do {
|
||||
current_weight = BLI_heap_node_value(BLI_heap_top(edge_heap));
|
||||
select_eed = BLI_heap_popmin(edge_heap);
|
||||
select_eed = BLI_heap_pop_min(edge_heap);
|
||||
} while (select_eed != NULL && select_eed->v1->f1 != 0 && select_eed->v2->f1);
|
||||
|
||||
if (select_eed != NULL) {
|
||||
|
|
|
@ -527,7 +527,7 @@ static GHash *dupli_keyIndexHash(GHash *keyindex)
|
|||
GHash *gh;
|
||||
GHashIterator gh_iter;
|
||||
|
||||
gh = BLI_ghash_ptr_new_ex("dupli_keyIndex gh", BLI_ghash_size(keyindex));
|
||||
gh = BLI_ghash_ptr_new_ex("dupli_keyIndex gh", BLI_ghash_len(keyindex));
|
||||
|
||||
GHASH_ITER (gh_iter, keyindex) {
|
||||
void *cv = BLI_ghashIterator_getKey(&gh_iter);
|
||||
|
|
|
@ -359,7 +359,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
|
|||
wmOperator *op = arg;
|
||||
struct CurveDrawData *cdd = op->customdata;
|
||||
|
||||
const int stroke_len = BLI_mempool_count(cdd->stroke_elem_pool);
|
||||
const int stroke_len = BLI_mempool_len(cdd->stroke_elem_pool);
|
||||
|
||||
if (stroke_len == 0) {
|
||||
return;
|
||||
|
@ -677,7 +677,7 @@ static void curve_draw_exec_precalc(wmOperator *op)
|
|||
if (!RNA_property_is_set(op->ptr, prop)) {
|
||||
bool use_cyclic = false;
|
||||
|
||||
if (BLI_mempool_count(cdd->stroke_elem_pool) > 2) {
|
||||
if (BLI_mempool_len(cdd->stroke_elem_pool) > 2) {
|
||||
BLI_mempool_iter iter;
|
||||
const struct StrokeElem *selem, *selem_first, *selem_last;
|
||||
|
||||
|
@ -703,7 +703,7 @@ static void curve_draw_exec_precalc(wmOperator *op)
|
|||
(cps->radius_taper_end != 0.0f))
|
||||
{
|
||||
/* note, we could try to de-duplicate the length calculations above */
|
||||
const int stroke_len = BLI_mempool_count(cdd->stroke_elem_pool);
|
||||
const int stroke_len = BLI_mempool_len(cdd->stroke_elem_pool);
|
||||
|
||||
BLI_mempool_iter iter;
|
||||
struct StrokeElem *selem, *selem_prev;
|
||||
|
@ -763,14 +763,14 @@ static int curve_draw_exec(bContext *C, wmOperator *op)
|
|||
Curve *cu = obedit->data;
|
||||
ListBase *nurblist = object_editcurve_get(obedit);
|
||||
|
||||
int stroke_len = BLI_mempool_count(cdd->stroke_elem_pool);
|
||||
int stroke_len = BLI_mempool_len(cdd->stroke_elem_pool);
|
||||
|
||||
const bool is_3d = (cu->flag & CU_3D) != 0;
|
||||
invert_m4_m4(obedit->imat, obedit->obmat);
|
||||
|
||||
if (BLI_mempool_count(cdd->stroke_elem_pool) == 0) {
|
||||
if (BLI_mempool_len(cdd->stroke_elem_pool) == 0) {
|
||||
curve_draw_stroke_from_operator(op);
|
||||
stroke_len = BLI_mempool_count(cdd->stroke_elem_pool);
|
||||
stroke_len = BLI_mempool_len(cdd->stroke_elem_pool);
|
||||
}
|
||||
|
||||
ED_curve_deselect_all(cu->editnurb);
|
||||
|
|
|
@ -1607,7 +1607,7 @@ static void curve_select_shortest_path_surf(Nurb *nu, int vert_src, int vert_dst
|
|||
int axis, sign;
|
||||
int u, v;
|
||||
|
||||
vert_curr = *((int *)BLI_heap_popmin(heap));
|
||||
vert_curr = *((int *)BLI_heap_pop_min(heap));
|
||||
if (vert_curr == vert_dst) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2284,7 +2284,7 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
|
|||
/* point to knife edges we've created edges in, edge_array aligned */
|
||||
KnifeEdge **kfe_array = BLI_array_alloca(kfe_array, edge_array_len);
|
||||
|
||||
BLI_assert(BLI_gset_size(kcd->edgenet.edge_visit) == 0);
|
||||
BLI_assert(BLI_gset_len(kcd->edgenet.edge_visit) == 0);
|
||||
|
||||
i = 0;
|
||||
for (ref = kfedges->first; ref; ref = ref->next) {
|
||||
|
|
|
@ -759,7 +759,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
|
|||
MEM_freeN(uniqueUv);
|
||||
|
||||
/* Allocate connectivity data, we allocate edges once */
|
||||
data->uvedges = MEM_mallocN(sizeof(*data->uvedges) * BLI_ghash_size(edgeHash), "uv_brush_edge_connectivity_data");
|
||||
data->uvedges = MEM_mallocN(sizeof(*data->uvedges) * BLI_ghash_len(edgeHash), "uv_brush_edge_connectivity_data");
|
||||
if (!data->uvedges) {
|
||||
BLI_ghash_free(edgeHash, NULL, NULL);
|
||||
MEM_freeN(edges);
|
||||
|
@ -772,7 +772,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
|
|||
GHASH_ITER (gh_iter, edgeHash) {
|
||||
data->uvedges[i++] = *((UvEdge *)BLI_ghashIterator_getKey(&gh_iter));
|
||||
}
|
||||
data->totalUvEdges = BLI_ghash_size(edgeHash);
|
||||
data->totalUvEdges = BLI_ghash_len(edgeHash);
|
||||
|
||||
/* cleanup temporary stuff */
|
||||
BLI_ghash_free(edgeHash, NULL, NULL);
|
||||
|
|
|
@ -113,7 +113,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
|
|||
}
|
||||
|
||||
if (unused) {
|
||||
if (BLI_mempool_count(ts) == unused) {
|
||||
if (BLI_mempool_len(ts) == unused) {
|
||||
BLI_mempool_destroy(ts);
|
||||
soops->treestore = NULL;
|
||||
if (soops->treehash) {
|
||||
|
@ -123,7 +123,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
|
|||
}
|
||||
else {
|
||||
TreeStoreElem *tsenew;
|
||||
BLI_mempool *new_ts = BLI_mempool_create(sizeof(TreeStoreElem), BLI_mempool_count(ts) - unused,
|
||||
BLI_mempool *new_ts = BLI_mempool_create(sizeof(TreeStoreElem), BLI_mempool_len(ts) - unused,
|
||||
512, BLI_MEMPOOL_ALLOW_ITER);
|
||||
BLI_mempool_iternew(ts, &iter);
|
||||
while ((tselem = BLI_mempool_iterstep(&iter))) {
|
||||
|
@ -1635,7 +1635,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
|
|||
Base *base;
|
||||
TreeElement *te = NULL, *ten;
|
||||
TreeStoreElem *tselem;
|
||||
int show_opened = !soops->treestore || !BLI_mempool_count(soops->treestore); /* on first view, we open scenes */
|
||||
int show_opened = !soops->treestore || !BLI_mempool_len(soops->treestore); /* on first view, we open scenes */
|
||||
|
||||
/* Are we looking for something - we want to tag parents to filter child matches
|
||||
* - NOT in datablocks view - searching all datablocks takes way too long to be useful
|
||||
|
|
|
@ -1291,7 +1291,7 @@ static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
|
|||
while (nedges > 2) {
|
||||
PEdge *ne, *ne1, *ne2;
|
||||
|
||||
e = (PEdge *)BLI_heap_popmin(heap);
|
||||
e = (PEdge *)BLI_heap_pop_min(heap);
|
||||
|
||||
e1 = p_boundary_edge_prev(e);
|
||||
e2 = p_boundary_edge_next(e);
|
||||
|
@ -2190,7 +2190,7 @@ static void p_chart_simplify_compute(PChart *chart)
|
|||
break;
|
||||
|
||||
HeapNode *link = BLI_heap_top(heap);
|
||||
PEdge *edge = (PEdge *)BLI_heap_popmin(heap), *pair = edge->pair;
|
||||
PEdge *edge = (PEdge *)BLI_heap_pop_min(heap), *pair = edge->pair;
|
||||
PVert *oldv, *keepv;
|
||||
PEdge *wheele, *nexte;
|
||||
|
||||
|
|
|
@ -1782,7 +1782,7 @@ static int stitch_init(bContext *C, wmOperator *op)
|
|||
}
|
||||
}
|
||||
|
||||
total_edges = BLI_ghash_size(edge_hash);
|
||||
total_edges = BLI_ghash_len(edge_hash);
|
||||
state->edges = edges = MEM_mallocN(sizeof(*edges) * total_edges, "stitch_edges");
|
||||
|
||||
/* I assume any system will be able to at least allocate an iterator :p */
|
||||
|
|
|
@ -2009,7 +2009,7 @@ bool GPU_pbvh_buffers_diffuse_changed(
|
|||
}
|
||||
else if (buffers->use_bmesh) {
|
||||
/* due to dynamic nature of dyntopo, only get first material */
|
||||
if (BLI_gset_size(bm_faces) > 0) {
|
||||
if (BLI_gset_len(bm_faces) > 0) {
|
||||
GSetIterator gs_iter;
|
||||
BMFace *f;
|
||||
|
||||
|
|
|
@ -513,7 +513,7 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_
|
|||
*points_r = cache->points;
|
||||
}
|
||||
else {
|
||||
int totframe = BLI_ghash_size(cache->hash);
|
||||
int totframe = BLI_ghash_len(cache->hash);
|
||||
int *frames = MEM_callocN(totframe * sizeof(int), "movieclip cache frames");
|
||||
int a, totseg = 0;
|
||||
GHashIterator gh_iter;
|
||||
|
|
|
@ -154,7 +154,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
|
|||
|
||||
numLoops_dst += mp->totloop;
|
||||
}
|
||||
BLI_assert(hash_num == BLI_ghash_size(vertHash));
|
||||
BLI_assert(hash_num == BLI_ghash_len(vertHash));
|
||||
|
||||
/* get the set of edges that will be in the new mesh (i.e. all edges
|
||||
* that have both verts in the new mesh)
|
||||
|
@ -187,7 +187,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
|
|||
*/
|
||||
medge = medge_src;
|
||||
hash_num = 0;
|
||||
BLI_assert(hash_num == BLI_ghash_size(vertHash));
|
||||
BLI_assert(hash_num == BLI_ghash_len(vertHash));
|
||||
for (i = 0; i < numEdges_dst; i++) {
|
||||
void **val_p;
|
||||
me = medge + edgeMap[i];
|
||||
|
@ -201,11 +201,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
|
|||
hash_num++;
|
||||
}
|
||||
}
|
||||
BLI_assert(hash_num == BLI_ghash_size(vertHash));
|
||||
BLI_assert(hash_num == BLI_ghash_len(vertHash));
|
||||
|
||||
/* get the set of edges that will be in the new mesh */
|
||||
for (i = 0; i < numEdges_dst; i++) {
|
||||
j = BLI_ghash_size(edgeHash);
|
||||
j = BLI_ghash_len(edgeHash);
|
||||
|
||||
BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(j),
|
||||
SET_INT_IN_POINTER(edgeMap[i]));
|
||||
|
@ -232,8 +232,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
|
|||
/* now we know the number of verts, edges and faces, we can create
|
||||
* the mesh
|
||||
*/
|
||||
result = CDDM_from_template(dm, BLI_ghash_size(vertHash),
|
||||
BLI_ghash_size(edgeHash), 0, numLoops_dst, numFaces_dst);
|
||||
result = CDDM_from_template(dm, BLI_ghash_len(vertHash),
|
||||
BLI_ghash_len(edgeHash), 0, numLoops_dst, numFaces_dst);
|
||||
|
||||
/* copy the vertices across */
|
||||
GHASH_ITER (gh_iter, vertHash) {
|
||||
|
@ -250,7 +250,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
|
|||
}
|
||||
|
||||
/* copy the edges across, remapping indices */
|
||||
for (i = 0; i < BLI_ghash_size(edgeHash); i++) {
|
||||
for (i = 0; i < BLI_ghash_len(edgeHash); i++) {
|
||||
MEdge source;
|
||||
MEdge *dest;
|
||||
int oldIndex = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_INT_IN_POINTER(i)));
|
||||
|
|
|
@ -1470,7 +1470,7 @@ static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
|
|||
while (!BLI_heap_is_empty(heap)) {
|
||||
BMFace *adj[2];
|
||||
|
||||
e = BLI_heap_popmin(heap);
|
||||
e = BLI_heap_pop_min(heap);
|
||||
|
||||
if (BM_edge_face_pair(e, &adj[0], &adj[1])) {
|
||||
/* If both triangles still free, and if they don't already
|
||||
|
|
|
@ -566,7 +566,7 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
|
|||
switch (slot->slot_subtype.map) {
|
||||
case BMO_OP_SLOT_SUBTYPE_MAP_ELEM:
|
||||
{
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_size(slot_hash) : 0);
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_len(slot_hash) : 0);
|
||||
if (slot_hash) {
|
||||
GHASH_ITER (hash_iter, slot_hash) {
|
||||
BMHeader *ele_key = BLI_ghashIterator_getKey(&hash_iter);
|
||||
|
@ -584,7 +584,7 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
|
|||
}
|
||||
case BMO_OP_SLOT_SUBTYPE_MAP_FLT:
|
||||
{
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_size(slot_hash) : 0);
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_len(slot_hash) : 0);
|
||||
if (slot_hash) {
|
||||
GHASH_ITER (hash_iter, slot_hash) {
|
||||
BMHeader *ele_key = BLI_ghashIterator_getKey(&hash_iter);
|
||||
|
@ -602,7 +602,7 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
|
|||
}
|
||||
case BMO_OP_SLOT_SUBTYPE_MAP_INT:
|
||||
{
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_size(slot_hash) : 0);
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_len(slot_hash) : 0);
|
||||
if (slot_hash) {
|
||||
GHASH_ITER (hash_iter, slot_hash) {
|
||||
BMHeader *ele_key = BLI_ghashIterator_getKey(&hash_iter);
|
||||
|
@ -620,7 +620,7 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
|
|||
}
|
||||
case BMO_OP_SLOT_SUBTYPE_MAP_BOOL:
|
||||
{
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_size(slot_hash) : 0);
|
||||
item = _PyDict_NewPresized(slot_hash ? BLI_ghash_len(slot_hash) : 0);
|
||||
if (slot_hash) {
|
||||
GHASH_ITER (hash_iter, slot_hash) {
|
||||
BMHeader *ele_key = BLI_ghashIterator_getKey(&hash_iter);
|
||||
|
|
|
@ -384,7 +384,7 @@ static PyObject *pyop_dir(PyObject *UNUSED(self))
|
|||
int i;
|
||||
|
||||
WM_operatortype_iter(&iter);
|
||||
list = PyList_New(BLI_ghash_size(iter.gh));
|
||||
list = PyList_New(BLI_ghash_len(iter.gh));
|
||||
|
||||
for (i = 0; !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter), i++) {
|
||||
wmOperatorType *ot = BLI_ghashIterator_getValue(&iter);
|
||||
|
|
|
@ -223,7 +223,7 @@ static PyObject *id_free_weakref_cb(PyObject *weakinfo_capsule, PyObject *weakre
|
|||
GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_capsule, NULL);
|
||||
|
||||
|
||||
if (BLI_ghash_size(weakinfo_hash) > 1) {
|
||||
if (BLI_ghash_len(weakinfo_hash) > 1) {
|
||||
BLI_ghash_remove(weakinfo_hash, weakref, NULL, NULL);
|
||||
}
|
||||
else { /* get the last id and free it */
|
||||
|
@ -243,7 +243,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
|
|||
BLI_ghashIterator_init(&weakinfo_hash_iter, weakinfo_hash);
|
||||
|
||||
#ifdef DEBUG_RNA_WEAKREF
|
||||
fprintf(stdout, "id_release_weakref: '%s', %d items\n", id->name, BLI_ghash_size(weakinfo_hash));
|
||||
fprintf(stdout, "id_release_weakref: '%s', %d items\n", id->name, BLI_ghash_len(weakinfo_hash));
|
||||
#endif
|
||||
|
||||
while (!BLI_ghashIterator_done(&weakinfo_hash_iter)) {
|
||||
|
@ -266,7 +266,7 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
|
|||
BLI_ghash_remove(id_weakref_pool, (void *)id, NULL, NULL);
|
||||
BLI_ghash_free(weakinfo_hash, NULL, NULL);
|
||||
|
||||
if (BLI_ghash_size(id_weakref_pool) == 0) {
|
||||
if (BLI_ghash_len(id_weakref_pool) == 0) {
|
||||
BLI_ghash_free(id_weakref_pool, NULL, NULL);
|
||||
id_weakref_pool = NULL;
|
||||
#ifdef DEBUG_RNA_WEAKREF
|
||||
|
|
|
@ -35,7 +35,7 @@ extern "C" {
|
|||
printf("GHash stats (%u entries):\n\t" \
|
||||
"Quality (the lower the better): %f\n\tVariance (the lower the better): %f\n\tLoad: %f\n\t" \
|
||||
"Empty buckets: %.2f%%\n\tOverloaded buckets: %.2f%% (biggest bucket: %d)\n", \
|
||||
BLI_ghash_size(_gh), q, var, lf, pempty * 100.0, poverloaded * 100.0, bigb); \
|
||||
BLI_ghash_len(_gh), q, var, lf, pempty * 100.0, poverloaded * 100.0, bigb); \
|
||||
} void (0)
|
||||
|
||||
/* Str: whole text, lines and words from a 'corpus' text. */
|
||||
|
@ -214,7 +214,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr
|
|||
|
||||
TIMEIT_END(int_pop);
|
||||
}
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), 0);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), 0);
|
||||
|
||||
BLI_ghash_free(ghash, NULL, NULL);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ extern "C" {
|
|||
printf("GHash stats (%d entries):\n\t" \
|
||||
"Quality (the lower the better): %f\n\tVariance (the lower the better): %f\n\tLoad: %f\n\t" \
|
||||
"Empty buckets: %.2f%%\n\tOverloaded buckets: %.2f%% (biggest bucket: %d)\n", \
|
||||
BLI_ghash_size(_gh), q, var, lf, pempty * 100.0, poverloaded * 100.0, bigb); \
|
||||
BLI_ghash_len(_gh), q, var, lf, pempty * 100.0, poverloaded * 100.0, bigb); \
|
||||
} void (0)
|
||||
|
||||
/* Note: for pure-ghash testing, nature of the keys and data have absolutely no importance! So here we just use mere
|
||||
|
@ -62,7 +62,7 @@ TEST(ghash, InsertLookup)
|
|||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), TESTCASE_SIZE);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_lookup(ghash, SET_UINT_IN_POINTER(*k));
|
||||
|
@ -85,16 +85,16 @@ TEST(ghash, InsertRemove)
|
|||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), TESTCASE_SIZE);
|
||||
bkt_size = BLI_ghash_buckets_size(ghash);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
bkt_size = BLI_ghash_buckets_len(ghash);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_popkey(ghash, SET_UINT_IN_POINTER(*k), NULL);
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *k);
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), 0);
|
||||
EXPECT_EQ(BLI_ghash_buckets_size(ghash), bkt_size);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), 0);
|
||||
EXPECT_EQ(BLI_ghash_buckets_len(ghash), bkt_size);
|
||||
|
||||
BLI_ghash_free(ghash, NULL, NULL);
|
||||
}
|
||||
|
@ -113,16 +113,16 @@ TEST(ghash, InsertRemoveShrink)
|
|||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), TESTCASE_SIZE);
|
||||
bkt_size = BLI_ghash_buckets_size(ghash);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
bkt_size = BLI_ghash_buckets_len(ghash);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_popkey(ghash, SET_UINT_IN_POINTER(*k), NULL);
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *k);
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), 0);
|
||||
EXPECT_LT(BLI_ghash_buckets_size(ghash), bkt_size);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), 0);
|
||||
EXPECT_LT(BLI_ghash_buckets_len(ghash), bkt_size);
|
||||
|
||||
BLI_ghash_free(ghash, NULL, NULL);
|
||||
}
|
||||
|
@ -141,12 +141,12 @@ TEST(ghash, Copy)
|
|||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), TESTCASE_SIZE);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
|
||||
ghash_copy = BLI_ghash_copy(ghash, NULL, NULL);
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash_copy), TESTCASE_SIZE);
|
||||
EXPECT_EQ(BLI_ghash_buckets_size(ghash_copy), BLI_ghash_buckets_size(ghash));
|
||||
EXPECT_EQ(BLI_ghash_len(ghash_copy), TESTCASE_SIZE);
|
||||
EXPECT_EQ(BLI_ghash_buckets_len(ghash_copy), BLI_ghash_buckets_len(ghash));
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_lookup(ghash_copy, SET_UINT_IN_POINTER(*k));
|
||||
|
@ -171,7 +171,7 @@ TEST(ghash, Pop)
|
|||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), TESTCASE_SIZE);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
|
||||
GHashIterState pop_state = {0};
|
||||
|
||||
|
@ -186,7 +186,7 @@ TEST(ghash, Pop)
|
|||
}
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), (TESTCASE_SIZE - TESTCASE_SIZE / 2 + TESTCASE_SIZE / 4));
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), (TESTCASE_SIZE - TESTCASE_SIZE / 2 + TESTCASE_SIZE / 4));
|
||||
|
||||
{
|
||||
void *k, *v;
|
||||
|
@ -194,7 +194,7 @@ TEST(ghash, Pop)
|
|||
EXPECT_EQ(k, v);
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(BLI_ghash_size(ghash), 0);
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), 0);
|
||||
|
||||
BLI_ghash_free(ghash, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ TEST(heap, Empty)
|
|||
|
||||
heap = BLI_heap_new();
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
EXPECT_EQ(BLI_heap_size(heap), 0);
|
||||
EXPECT_EQ(BLI_heap_len(heap), 0);
|
||||
BLI_heap_free(heap, NULL);
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,10 @@ TEST(heap, One)
|
|||
|
||||
BLI_heap_insert(heap, 0.0f, (void *)in);
|
||||
EXPECT_FALSE(BLI_heap_is_empty(heap));
|
||||
EXPECT_EQ(BLI_heap_size(heap), 1);
|
||||
EXPECT_EQ(in, BLI_heap_popmin(heap));
|
||||
EXPECT_EQ(BLI_heap_len(heap), 1);
|
||||
EXPECT_EQ(in, BLI_heap_pop_min(heap));
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
EXPECT_EQ(BLI_heap_size(heap), 0);
|
||||
EXPECT_EQ(BLI_heap_len(heap), 0);
|
||||
BLI_heap_free(heap, NULL);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ TEST(heap, Range)
|
|||
BLI_heap_insert(heap, (float)in, SET_INT_IN_POINTER(in));
|
||||
}
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_popmin(heap)));
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
|
@ -73,7 +73,7 @@ TEST(heap, RangeReverse)
|
|||
BLI_heap_insert(heap, (float)-in, SET_INT_IN_POINTER(-in));
|
||||
}
|
||||
for (int out_test = items_total - 1; out_test >= 0; out_test--) {
|
||||
EXPECT_EQ(-out_test, GET_INT_FROM_POINTER(BLI_heap_popmin(heap)));
|
||||
EXPECT_EQ(-out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
|
@ -92,7 +92,7 @@ TEST(heap, RangeRemove)
|
|||
nodes[i] = NULL;
|
||||
}
|
||||
for (int out_test = 1; out_test < items_total; out_test += 2) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_popmin(heap)));
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
|
@ -107,7 +107,7 @@ TEST(heap, Duplicates)
|
|||
BLI_heap_insert(heap, 1.0f, 0);
|
||||
}
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(0, GET_INT_FROM_POINTER(BLI_heap_popmin(heap)));
|
||||
EXPECT_EQ(0, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
|
@ -125,7 +125,7 @@ static void random_heap_helper(
|
|||
BLI_heap_insert(heap, values[i], SET_INT_IN_POINTER((int)values[i]));
|
||||
}
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_popmin(heap)));
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
|
@ -150,7 +150,7 @@ TEST(heap, ReInsertSimple)
|
|||
}
|
||||
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_popmin(heap)));
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
|
@ -177,7 +177,7 @@ static void random_heap_reinsert_helper(
|
|||
HeapNode *node_top = BLI_heap_top(heap);
|
||||
float out = BLI_heap_node_value(node_top);
|
||||
EXPECT_EQ((float)out_test, out);
|
||||
BLI_heap_popmin(heap);
|
||||
BLI_heap_pop_min(heap);
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
|
|
|
@ -34,7 +34,7 @@ TEST(kdopbvh, Empty)
|
|||
{
|
||||
BVHTree *tree = BLI_bvhtree_new(0, 0.0, 8, 8);
|
||||
BLI_bvhtree_balance(tree);
|
||||
EXPECT_EQ(0, BLI_bvhtree_get_size(tree));
|
||||
EXPECT_EQ(0, BLI_bvhtree_get_len(tree));
|
||||
BLI_bvhtree_free(tree);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ TEST(kdopbvh, Single)
|
|||
BLI_bvhtree_insert(tree, 0, co, 1);
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_bvhtree_get_size(tree), 1);
|
||||
EXPECT_EQ(BLI_bvhtree_get_len(tree), 1);
|
||||
|
||||
BLI_bvhtree_balance(tree);
|
||||
BLI_bvhtree_free(tree);
|
||||
|
|
|
@ -101,7 +101,7 @@ static void test_polyfill_topology(
|
|||
}
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(BLI_edgehash_size(edgehash), poly_tot + (poly_tot - 3));
|
||||
EXPECT_EQ(BLI_edgehash_len(edgehash), poly_tot + (poly_tot - 3));
|
||||
|
||||
for (i = 0; i < poly_tot; i++) {
|
||||
const unsigned int v1 = i;
|
||||
|
|
Loading…
Reference in New Issue