summaryrefslogtreecommitdiff
path: root/do_tris.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_tris.c
parentf021fe33579e75bd19e7b5784858be14c3e3c4b6 (diff)
Variable scope reductions as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'do_tris.c')
-rw-r--r--do_tris.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/do_tris.c b/do_tris.c
index 0a8d511..6605fd1 100644
--- a/do_tris.c
+++ b/do_tris.c
@@ -1,3 +1,6 @@
+
+
+
/*****************************************************************************
Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -58,7 +61,7 @@ Distance(XPoint p1, XPoint p2)
int
InitTriangles(XParms xp, Parms p, int64_t reps)
{
- int i, j, numPoints;
+ int numPoints;
int rows;
int x, y;
int size, iradius;
@@ -95,8 +98,8 @@ InitTriangles(XParms xp, Parms p, int64_t reps)
rows = 0;
aarea = 0.0;
- for (i = 0; i != p->objects; i++) {
- for (j = 0; j != NUM_POINTS; j++) {
+ for (int i = 0; i != p->objects; i++) {
+ for (int j = 0; j != NUM_POINTS; j++) {
phi2 = phi + ((double) j) * delta;
curPoint->x = (int) ((double)x + (radius * cos(phi2)) + 0.5);
curPoint->y = (int) ((double)y + (radius * sin(phi2)) + 0.5);
@@ -134,12 +137,9 @@ InitTriangles(XParms xp, Parms p, int64_t reps)
void
DoTriangles(XParms xp, Parms p, int64_t reps)
{
- int i, j;
- XPoint *curPoint;
-
- for (i = 0; i != reps; i++) {
- curPoint = points;
- for (j = 0; j != p->objects; j++) {
+ for (int i = 0; i != reps; i++) {
+ XPoint *curPoint = points;
+ for (int j = 0; j != p->objects; j++) {
XFillPolygon(xp->d, xp->w, pgc, curPoint, NUM_POINTS, Convex,
CoordModeOrigin);
curPoint += NUM_POINTS;
@@ -209,10 +209,7 @@ XPolyTriangle(register Display *dpy,
void
DoTriangles(XParms xp, Parms p, int64_t reps)
{
- int i, j;
- XPoint *curPoint;
-
- for (i = 0; i != reps; i++) {
+ for (int i = 0; i != reps; i++) {
XPolyTriangle (xp->d, xp->w, pgc, points, p->objects, Convex,
CoordModeOrigin);
if (pgc == xp->bggc)