Cleanup: redundant index loop for monkey-create
authorCampbell Barton <ideasman42@gmail.com>
Thu, 17 Nov 2016 19:08:51 +0000 (06:08 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 17 Nov 2016 19:10:53 +0000 (06:10 +1100)
Also rename face vars (the faces aren't temp),
and quiet old-style-definition warning.

source/blender/blenkernel/intern/blender_undo.c
source/blender/bmesh/intern/bmesh_queries.h
source/blender/bmesh/operators/bmo_primitive.c

index ce6d29bbfeea36e52ef63b16c01d7161d70beb39..bc98d6f68051d2fbd4fa614def79f59d90e0a5fe 100644 (file)
@@ -320,7 +320,7 @@ const char *BKE_undo_get_name(int nr, bool *r_active)
 }
 
 /* return the name of the last item */
-const char *BKE_undo_get_name_last()
+const char *BKE_undo_get_name_last(void)
 {
        UndoElem *uel = undobase.last;
        return (uel ? uel->name : NULL);
index a6a37767ee9c68e9a319351f3f731b7ba6b29a0e..903fdc59cb8d6b1406d6da64ba21efecf5973b24 100644 (file)
@@ -135,7 +135,7 @@ BMLoop *BM_face_find_longest_loop(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNUL
 BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 BMEdge *BM_edge_find_double(BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 
-BMFaceBM_face_exists(BMVert **varr, int len) ATTR_NONNULL(1);
+BMFace *BM_face_exists(BMVert **varr, int len) ATTR_NONNULL(1);
 
 bool    BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 bool    BM_face_exists_multi_edge(BMEdge **earr, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
index 7b32921f8cff6c5d6a77eef27e3f835bc326f69d..8408169d85e50888565fcfeaaf3dde2fe1376c3e 100644 (file)
@@ -1174,7 +1174,7 @@ void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag)
        }
 
        BMIter iter2;
-       BMLoopl;
+       BMLoop *l;
        int loop_index;
        float minx = 1.0f;
 
@@ -1236,14 +1236,14 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
        int uvi = 0;
        const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
        for (i = 0; i < monkeynf; i++) {
-               BMFace* temp1 = BM_face_create_quad_tri(bm,
+               BMFace *f_new_a = BM_face_create_quad_tri(bm,
                                        tv[monkeyf[i][0] + i - monkeyo],
                                        tv[monkeyf[i][1] + i - monkeyo],
                                        tv[monkeyf[i][2] + i - monkeyo],
                                        (monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeyf[i][3] + i - monkeyo] : NULL,
                                        NULL, BM_CREATE_NOP);
 
-               BMFace* temp2 = BM_face_create_quad_tri(bm,
+               BMFace *f_new_b = BM_face_create_quad_tri(bm,
                                        tv[monkeynv + monkeyf[i][2] + i - monkeyo],
                                        tv[monkeynv + monkeyf[i][1] + i - monkeyo],
                                        tv[monkeynv + monkeyf[i][0] + i - monkeyo],
@@ -1252,20 +1252,19 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
 
                /* Set the UVs here, the iteration order of the faces is not guaranteed,
                 * so it's best to set the UVs right after the face is created. */
-               if(calc_uvs) {
-                       BMLoopl;
+               if (calc_uvs) {
+                       BMLoop *l;
                        BMIter liter;
-                       int loop_index;
-                       BM_ITER_ELEM_INDEX (l, &liter, temp1, BM_LOOPS_OF_FACE, loop_index) {
+                       BM_ITER_ELEM (l, &liter, f_new_a, BM_LOOPS_OF_FACE) {
                                MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
-                               luv->uv[0] = monkeyuvs[uvi*2 + 0];
-                               luv->uv[1] = monkeyuvs[uvi*2 + 1];
+                               luv->uv[0] = monkeyuvs[uvi * 2 + 0];
+                               luv->uv[1] = monkeyuvs[uvi * 2 + 1];
                                uvi++;
                        }
-                       BM_ITER_ELEM_INDEX (l, &liter, temp2, BM_LOOPS_OF_FACE, loop_index) {
+                       BM_ITER_ELEM (l, &liter, f_new_b, BM_LOOPS_OF_FACE) {
                                MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
-                               luv->uv[0] = monkeyuvs[uvi*2 + 0];
-                               luv->uv[1] = monkeyuvs[uvi*2 + 1];
+                               luv->uv[0] = monkeyuvs[uvi * 2 + 0];
+                               luv->uv[1] = monkeyuvs[uvi * 2 + 1];
                                uvi++;
                        }