Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-08 09:50:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-08 09:50:38 +0400
commit5580afb5dfe98771c7db8b0660398c47751c1ade (patch)
treef99c7913a62f561a29dd6abc918868232275ce24 /source/blender/bmesh/intern/bmesh_operators.c
parentebaf3781fa4165808cd9ddb2ed0944788a31af7c (diff)
GHash/Edgehash: make simple iterator checking functions inline.
also remove NULL check, only a few areas made use of this.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_operators.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 086233ebe09..2a6b4d70419 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -347,13 +347,10 @@ void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_n
}
}
else if (slot_dst->slot_type == BMO_OP_SLOT_MAPPING) {
- GHashIterator it;
- for (BLI_ghashIterator_init(&it, slot_src->data.ghash);
- BLI_ghashIterator_done(&it) == false;
- BLI_ghashIterator_step(&it))
- {
- void *key = BLI_ghashIterator_getKey(&it);
- void *val = BLI_ghashIterator_getValue(&it);
+ GHashIterator gh_iter;
+ GHASH_ITER (gh_iter, slot_src->data.ghash) {
+ void *key = BLI_ghashIterator_getKey(&gh_iter);
+ void *val = BLI_ghashIterator_getValue(&gh_iter);
BLI_ghash_insert(slot_dst->data.ghash, key, val);
}
}
@@ -722,17 +719,15 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
- GHashIterator it;
+ GHashIterator gh_iter;
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMElemF *ele_f;
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
- for (BLI_ghashIterator_init(&it, slot->data.ghash);
- (ele_f = BLI_ghashIterator_getKey(&it));
- BLI_ghashIterator_step(&it))
- {
+ GHASH_ITER (gh_iter, slot->data.ghash) {
+ ele_f = BLI_ghashIterator_getKey(&gh_iter);
if (ele_f->head.htype & htype) {
BMO_elem_flag_enable(bm, ele_f, oflag);
}
@@ -1424,10 +1419,19 @@ void *BMO_iter_step(BMOIter *iter)
return ele;
}
else if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
- void *ret = BLI_ghashIterator_getKey(&iter->giter);
- iter->val = BLI_ghashIterator_getValue_p(&iter->giter);
+ void *ret;
+
+
+ if (BLI_ghashIterator_done(&iter->giter) == false) {
+ ret = BLI_ghashIterator_getKey(&iter->giter);
+ iter->val = BLI_ghashIterator_getValue_p(&iter->giter);
- BLI_ghashIterator_step(&iter->giter);
+ BLI_ghashIterator_step(&iter->giter);
+ }
+ else {
+ ret = NULL;
+ iter->val = NULL;
+ }
return ret;
}