diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-17 17:11:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-17 17:16:05 +0300 |
commit | 45e929dc127e5b037c9e073ad84c3d76ca11ac50 (patch) | |
tree | 90ed4686d7093b66c74440945583414580fbf3a8 /source | |
parent | fa0f936a64acf6620991f1ba6f968cd25edd17df (diff) |
Cleanup: redundant casts
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_log.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index 4db24478152..1f64f7b74cc 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -593,8 +593,8 @@ int BM_log_length(const BMLog *log) /* Apply a consistent ordering to BMesh vertices */ void BM_log_mesh_elems_reorder(BMesh *bm, BMLog *log) { - void *varr; - void *farr; + unsigned int *varr; + unsigned int *farr; GHash *id_to_idx; @@ -602,41 +602,37 @@ void BM_log_mesh_elems_reorder(BMesh *bm, BMLog *log) BMVert *v; BMFace *f; - int i; + unsigned int i; /* Put all vertex IDs into an array */ - i = 0; varr = MEM_mallocN(sizeof(int) * (size_t)bm->totvert, __func__); - BM_ITER_MESH (v, &bm_iter, bm, BM_VERTS_OF_MESH) { - ((unsigned int *)varr)[i++] = bm_log_vert_id_get(log, v); + BM_ITER_MESH_INDEX (v, &bm_iter, bm, BM_VERTS_OF_MESH, i) { + varr[i] = bm_log_vert_id_get(log, v); } /* Put all face IDs into an array */ - i = 0; farr = MEM_mallocN(sizeof(int) * (size_t)bm->totface, __func__); - BM_ITER_MESH (f, &bm_iter, bm, BM_FACES_OF_MESH) { - ((unsigned int *)farr)[i++] = bm_log_face_id_get(log, f); + BM_ITER_MESH_INDEX (f, &bm_iter, bm, BM_FACES_OF_MESH, i) { + farr[i] = bm_log_face_id_get(log, f); } /* Create BMVert index remap array */ id_to_idx = bm_log_compress_ids_to_indices(varr, (unsigned int)bm->totvert); - i = 0; - BM_ITER_MESH (v, &bm_iter, bm, BM_VERTS_OF_MESH) { + BM_ITER_MESH_INDEX (v, &bm_iter, bm, BM_VERTS_OF_MESH, i) { const unsigned id = bm_log_vert_id_get(log, v); const void *key = SET_UINT_IN_POINTER(id); const void *val = BLI_ghash_lookup(id_to_idx, key); - ((unsigned int *)varr)[i++] = GET_UINT_FROM_POINTER(val); + varr[i] = GET_UINT_FROM_POINTER(val); } BLI_ghash_free(id_to_idx, NULL, NULL); /* Create BMFace index remap array */ id_to_idx = bm_log_compress_ids_to_indices(farr, (unsigned int)bm->totface); - i = 0; - BM_ITER_MESH (f, &bm_iter, bm, BM_FACES_OF_MESH) { + BM_ITER_MESH_INDEX (f, &bm_iter, bm, BM_FACES_OF_MESH, i) { const unsigned id = bm_log_face_id_get(log, f); const void *key = SET_UINT_IN_POINTER(id); const void *val = BLI_ghash_lookup(id_to_idx, key); - ((unsigned int *)farr)[i++] = GET_UINT_FROM_POINTER(val); + farr[i] = GET_UINT_FROM_POINTER(val); } BLI_ghash_free(id_to_idx, NULL, NULL); |