From 2bf86981836efe4ac8d39e7f70f1f5480ddb732d Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Tue, 1 May 2012 10:34:02 +0400 Subject: [PATCH] Unnecessary casts removed --- ColoredSquare.c | 12 ++++++------ Square.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ColoredSquare.c b/ColoredSquare.c index da70431..e30998d 100644 --- a/ColoredSquare.c +++ b/ColoredSquare.c @@ -12,7 +12,7 @@ void ColoredSquare_constructor (ColoredSquare *this, a, color); Square_constructor ((Square *) this, a); - ((ColoredSquare *) this)->color = color; + this->color = color; } void ColoredSquare_copy (ColoredSquare *to, ColoredSquare *from) @@ -21,7 +21,7 @@ void ColoredSquare_copy (ColoredSquare *to, ColoredSquare *from) (unsigned long) to, (unsigned long) from); Square_copy ((Square *) to, (Square *) from); - ((ColoredSquare *) to)->color = ((ColoredSquare *) from)->color; + to->color = from->color; } ColoredSquare* ColoredSquare_clone (ColoredSquare *this) @@ -53,8 +53,8 @@ void ColoredSquare_draw (ColoredSquare *this) printf ("ColoredSquare_draw (%lu) called\n", (unsigned long) this); printf ("Drawing ColoredSquare with %f side and %d color\n", - ((ColoredSquare *) this)->a, - ((ColoredSquare *) this)->color); + this->a, + this->color); } void ColoredSquare_set_color (ColoredSquare *this, int color) @@ -63,7 +63,7 @@ void ColoredSquare_set_color (ColoredSquare *this, int color) (unsigned long) this, color); - ((ColoredSquare *) this)->color = color; + this->color = color; } /* public */ @@ -95,7 +95,7 @@ ColoredSquare* ColoredSquare_new (double a, int color) color, (unsigned long) square); - square->vtable = (ColoredSquare_interface *) &vtable; + square->vtable = &vtable; /*goto end; err: diff --git a/Square.c b/Square.c index 0c34c80..1fc5e8a 100644 --- a/Square.c +++ b/Square.c @@ -8,7 +8,7 @@ void Square_constructor (Square *this, double a) printf ("Square_constructor (%lu, %f) called\n", (unsigned long) this, a); - ((Square *) this)->a = a; + this->a = a; } void Square_destructor (Square *this) @@ -22,7 +22,7 @@ void Square_copy (Square *to, Square *from) printf ("Square_copy (%lu, %lu) called\n", (unsigned long) to, (unsigned long) from); - ((Square *) to)->a = ((Square *) from)->a; + to->a = from->a; } Square* Square_clone (Square *this) @@ -62,12 +62,12 @@ void Square_draw (Square *this) printf ("Square_draw (%lu) called\n", (unsigned long) this); printf ("Drawing Square with %f side\n", - ((Square *) this)->a); + this->a); } double Square_area (Square *this) { - double area = ((Square *)this)->a * ((Square *)this)->a; + double area = this->a * this->a; printf ("Square_area (%lu) called\n", (unsigned long) this); printf ("Square_area (%lu) returns %f\n", @@ -82,7 +82,7 @@ void Square_resize (Square *this, double a) printf ("Square_resize (%lu, %f) called\n", (unsigned long) this, a); - ((Square *) this)->a = a; + this->a = a; } double Square_diag_length (Square *this) @@ -123,7 +123,7 @@ Square* Square_new (double a) a, (unsigned long) square); - square->vtable = (Square_interface *) &vtable; + square->vtable = &vtable; /*goto end; err: