remove wanton use of array reallocation for mesh smoothing.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 12 May 2013 12:06:08 +0000 (12:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 12 May 2013 12:06:08 +0000 (12:06 +0000)
source/blender/bmesh/operators/bmo_utils.c

index af96b62e074893f1de79d1fd745f082d6e7dc706..7e86c0a52eaecf0092ec9d00a9c54fac0ec6c02a 100644 (file)
@@ -420,8 +420,7 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
        BMIter iter;
        BMVert *v;
        BMEdge *e;
-       BLI_array_declare(cos);
-       float (*cos)[3] = NULL;
+       float (*cos)[3] = MEM_mallocN(sizeof(*cos) * BMO_slot_buffer_count(op->slots_in, "verts"), __func__);
        float *co, *co2, clip_dist = BMO_slot_float_get(op->slots_in, "clip_dist");
        int i, j, clipx, clipy, clipz;
        int xaxis, yaxis, zaxis;
@@ -436,7 +435,6 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
 
        i = 0;
        BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
-               BLI_array_grow_one(cos);
 
                co = cos[i];
                zero_v3(co);
@@ -479,7 +477,7 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
                i++;
        }
 
-       BLI_array_free(cos);
+       MEM_freeN(cos);
 }
 
 /**************************************************************************** *