From 63916f5941b443dfc8566682bb75374e5abd553f Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 9 Sep 2020 18:41:07 +0200 Subject: Cleanup: reduce variable scope --- source/blender/editors/gpencil/gpencil_merge.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/gpencil/gpencil_merge.c') diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c index 4aae0b97e05..ca93e8de844 100644 --- a/source/blender/editors/gpencil/gpencil_merge.c +++ b/source/blender/editors/gpencil/gpencil_merge.c @@ -200,7 +200,6 @@ static void gpencil_calc_points_factor(bContext *C, tGPencilPointCache *src_array) { bGPDspoint *pt; - int i; int idx = 0; /* create selected point array an fill it */ @@ -214,6 +213,7 @@ static void gpencil_calc_points_factor(bContext *C, } LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { if (gps->flag & GP_STROKE_SELECT) { + int i; for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { if (clear_stroke) { pt->flag |= GP_SPOINT_TAG; @@ -252,7 +252,7 @@ static void gpencil_calc_points_factor(bContext *C, /* calc center */ float center[2] = {0.0f, 0.0f}; - for (i = 0; i < totpoints; i++) { + for (int i = 0; i < totpoints; i++) { center[0] += points2d[i][0]; center[1] += points2d[i][1]; } @@ -261,7 +261,7 @@ static void gpencil_calc_points_factor(bContext *C, /* calc angle and distance to center for each point */ const float axis[2] = {1.0f, 0.0f}; float v1[3]; - for (i = 0; i < totpoints; i++) { + for (int i = 0; i < totpoints; i++) { float ln = len_v2v2(center, points2d[i]); sub_v2_v2v2(v1, points2d[i], center); float angle = angle_signed_v2v2(axis, v1); @@ -337,10 +337,9 @@ static void gpencil_get_extremes( tGPencilPointCache *src_array, int totpoints, bGPDstroke *gps_filter, float *start, float *end) { tGPencilPointCache *array_pt = NULL; - int i; /* find first point */ - for (i = 0; i < totpoints; i++) { + for (int i = 0; i < totpoints; i++) { array_pt = &src_array[i]; if (gps_filter == array_pt->gps) { copy_v3_v3(start, &array_pt->x); @@ -348,7 +347,7 @@ static void gpencil_get_extremes( } } /* find last point */ - for (i = totpoints - 1; i >= 0; i--) { + for (int i = totpoints - 1; i >= 0; i--) { array_pt = &src_array[i]; if (gps_filter == array_pt->gps) { copy_v3_v3(end, &array_pt->x); -- cgit v1.2.3