summaryrefslogtreecommitdiff
path: root/do_dots.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 13:00:22 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 13:04:52 -0700
commit2900d7a7e7929414268cb142bf00c57d370e1396 (patch)
tree4c19cc7b6d5e440a32bf7579db3ef8d3112ffad9 /do_dots.c
parentf021fe33579e75bd19e7b5784858be14c3e3c4b6 (diff)
Variable scope reductions as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'do_dots.c')
-rw-r--r--do_dots.c8
1 files changed, 2 insertions, 6 deletions
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;