diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-13 07:47:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-13 07:54:54 +0300 |
commit | ab382230471c6ee94e82d0fac3f5093e30710628 (patch) | |
tree | 9a07f5978a79a687fff983120018eb50f1092a51 /source/blender/editors | |
parent | f731bce6cd42eda9c1ca5962b8d1ec99254c478f (diff) |
Cleanup: redundant initialization
These were limited to obvious cases. Some less obvious cases
were kept as refactoring might make them necessary in future.
Diffstat (limited to 'source/blender/editors')
11 files changed, 12 insertions, 22 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 535ccaa06fd..2999ac784ba 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6646,7 +6646,7 @@ void CURVE_OT_dissolve_verts(wmOperatorType *ot) static bool nurb_bezt_flag_any(const Nurb *nu, const char flag_test) { - BezTriple *bezt = nu->bezt; + const BezTriple *bezt; int i; for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) { diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index e4f2de1f741..03c120df28b 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -387,7 +387,6 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), GPU_matrix_translate_3f(selem->location_local[0] - location_prev[0], selem->location_local[1] - location_prev[1], selem->location_local[2] - location_prev[2]); - location_prev = selem->location_local; const float radius = stroke_elem_radius(cdd, selem); diff --git a/source/blender/editors/gpencil/gpencil_trace_utils.c b/source/blender/editors/gpencil/gpencil_trace_utils.c index 482f7015720..12c38fb2744 100644 --- a/source/blender/editors/gpencil/gpencil_trace_utils.c +++ b/source/blender/editors/gpencil/gpencil_trace_utils.c @@ -281,7 +281,6 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain, mat_mask_idx = ob->totcol - 1; } - potrace_path_t *path = st->plist; int n, *tag; potrace_dpoint_t(*c)[3]; @@ -289,7 +288,7 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain, * good results using the Potrace data. */ const float scalef = 0.008f * scale; /* Draw each curve. */ - path = st->plist; + potrace_path_t *path = st->plist; while (path != NULL) { n = path->curve.n; tag = path->curve.tag; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 3450d61337c..f306612f295 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -149,7 +149,7 @@ static void join_mesh_single(Depsgraph *depsgraph, mul_m4_m4m4(cmat, imat, ob_src->obmat); /* transform vertex coordinates into new space */ - for (a = 0, mvert = *mvert_pp; a < me->totvert; a++, mvert++) { + for (a = 0; a < me->totvert; a++, mvert++) { mul_m4_v3(cmat, mvert->co); } diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index b6205db6f45..71166b7c20c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1189,9 +1189,7 @@ static SculptUndoNode *sculpt_undo_geometry_push(Object *object, SculptUndoType static SculptUndoNode *sculpt_undo_face_sets_push(Object *ob, SculptUndoType type) { UndoSculpt *usculpt = sculpt_undo_get_nodes(); - SculptUndoNode *unode = usculpt->nodes.first; - - unode = MEM_callocN(sizeof(*unode), __func__); + SculptUndoNode *unode = MEM_callocN(sizeof(*unode), __func__); BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname)); unode->type = type; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index cd60ebf3031..369a6e7c944 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -1235,10 +1235,8 @@ static void do_movie_proxy(void *pjv, float *progress) { ProxyJob *pj = pjv; - Scene *scene = pj->scene; MovieClip *clip = pj->clip; struct MovieDistortion *distortion = NULL; - int cfra, sfra = SFRA, efra = EFRA; if (pj->index_context) { IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress); @@ -1252,8 +1250,8 @@ static void do_movie_proxy(void *pjv, return; } - sfra = 1; - efra = clip->len; + const int sfra = 1; + const int efra = clip->len; if (build_undistort_count) { int threads = BLI_system_thread_count(); @@ -1265,7 +1263,7 @@ static void do_movie_proxy(void *pjv, BKE_tracking_distortion_set_threads(distortion, threads); } - for (cfra = sfra; cfra <= efra; cfra++) { + for (int cfra = sfra; cfra <= efra; cfra++) { BKE_movieclip_build_proxy_frame( clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 0e22a2fffe1..068ee177d59 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1805,7 +1805,6 @@ static int graphkeys_mselect_column(bAnimContext *ac, KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked; tNearestVertInfo *nvi; - float selx = (float)ac->scene->r.cfra; /* find the beztriple that we're selecting, and the handle that was clicked on */ nvi = find_nearest_fcurve_vert(ac, mval); @@ -1817,7 +1816,7 @@ static int graphkeys_mselect_column(bAnimContext *ac, /* get frame number on which elements should be selected */ /* TODO: should we restrict to integer frames only? */ - selx = nvi->frame; + const float selx = nvi->frame; if (select_mode != SELECT_REPLACE) { /* Doesn't need to deselect anything -> Pass. */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 6053253790a..0c34c0cc756 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1311,7 +1311,6 @@ static int image_open_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); ImageUser *iuser = NULL; - ImageOpenData *iod = op->customdata; Image *ima = NULL; int frame_seq_len = 0; int frame_ofs = 1; @@ -1345,7 +1344,7 @@ static int image_open_exec(bContext *C, wmOperator *op) } /* hook into UI */ - iod = op->customdata; + ImageOpenData *iod = op->customdata; if (iod->pprop.prop) { /* when creating new ID blocks, use is already 1, but RNA diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index be3b60d581b..9524c2a1d8a 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -134,14 +134,12 @@ static void report_textview_end(TextViewContext *UNUSED(tvc)) static int report_textview_step(TextViewContext *tvc) { /* simple case, but no newline support */ - const Report *report = tvc->iter; - if (tvc->iter_char_begin <= 0) { tvc->iter = (void *)((Link *)tvc->iter)->prev; if (tvc->iter && report_textview_skip__internal(tvc)) { tvc->iter_tmp++; - report = tvc->iter; + const Report *report = tvc->iter; tvc->iter_char_end = report->len; /* reset start */ report_textview_init__internal(tvc); diff --git a/source/blender/editors/transform/transform_mode_maskshrinkfatten.c b/source/blender/editors/transform/transform_mode_maskshrinkfatten.c index 857ee37f0ad..cfbd6030788 100644 --- a/source/blender/editors/transform/transform_mode_maskshrinkfatten.c +++ b/source/blender/editors/transform/transform_mode_maskshrinkfatten.c @@ -89,7 +89,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) /* apply shrink/fatten */ FOREACH_TRANS_DATA_CONTAINER (t, tc) { - TransData *td = tc->data; + TransData *td; for (td = tc->data, i = 0; i < tc->data_len; i++, td++) { if (td->flag & TD_SKIP) { continue; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 193954fffb6..bebef049718 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1072,7 +1072,7 @@ static void TargetSnapClosest(TransInfo *t) if (t->options & CTX_OBJECT) { int i; FOREACH_TRANS_DATA_CONTAINER (t, tc) { - TransData *td = tc->data; + TransData *td; for (td = tc->data, i = 0; i < tc->data_len && td->flag & TD_SELECTED; i++, td++) { const BoundBox *bb = NULL; |