From 2900d7a7e7929414268cb142bf00c57d370e1396 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 15 Oct 2022 13:00:22 -0700 Subject: Variable scope reductions as recommended by cppcheck Signed-off-by: Alan Coopersmith --- do_dots.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'do_dots.c') diff --git a/do_dots.c b/do_dots.c index fe9ca2e..a02cb10 100644 --- a/do_dots.c +++ b/do_dots.c @@ -29,13 +29,11 @@ static GC pgc; int InitDots(XParms xp, Parms p, int64_t reps) { - int i; - pgc = xp->fggc; points = (XPoint *)malloc(p->objects * sizeof(XPoint)); - for (i = 0; i != p->objects; i++) { + for (int i = 0; i != p->objects; i++) { points[i].x = 2 * (i/MAXROWS); points[i].y = 2 * (i%MAXROWS); } @@ -45,9 +43,7 @@ InitDots(XParms xp, Parms p, int64_t reps) void DoDots(XParms xp, Parms p, int64_t reps) { - int i; - - for (i = 0; i != reps; i++) { + for (int i = 0; i != reps; i++) { XDrawPoints(xp->d, xp->w, pgc, points, p->objects, CoordModeOrigin); if (pgc == xp->bggc) pgc = xp->fggc; -- cgit v1.2.3