summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-12-10 22:21:38 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-12-10 22:30:35 -0800
commitfe5b68c75697eaba0af7240f0ccf5f0f1ac1063f (patch)
tree7cc278e1e5f00f87f46172c63e0cb0dbe334396e
parent4e3d140c4859124ae4cd87789d009c4a973d62c3 (diff)
Reduce scope of variables in check_jewel_poly
Suggested by cppcheck Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--Clock.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Clock.c b/Clock.c
index 04d7dfd..afa855d 100644
--- a/Clock.c
+++ b/Clock.c
@@ -473,12 +473,11 @@ paint_jewel (ClockWidget w, Drawable d, GC gc)
int
check_jewel_poly (ClockWidget w, TPoint poly[POLY_SIZE])
{
- double a2, b2, c2, d2;
- double x, y, size;
- int i;
-
if (JEWEL_SIZE(w) > 0.0)
{
+ double x, y, size;
+ int i;
+
x = JEWEL_X(w);
y = JEWEL_Y(w);
size = JEWEL_SIZE(w);
@@ -488,6 +487,8 @@ check_jewel_poly (ClockWidget w, TPoint poly[POLY_SIZE])
* circular jewel is less than the radius.
*/
for (i = 0; i < POLY_SIZE-1; i++) {
+ double a2, b2, c2, d2;
+
a2 = sqr (poly[i].x - x) + sqr (poly[i].y - y);
b2 = sqr (poly[i+1].x - x) + sqr (poly[i+1].y - y);
c2 = sqr (poly[i].x - poly[i+1].x) + sqr (poly[i].y - poly[i+1].y);