Unnecessary casts removed

This commit is contained in:
Kolan Sh 2012-05-01 10:34:02 +04:00
parent 47b5fa044d
commit 2bf8698183
2 changed files with 12 additions and 12 deletions

View File

@ -12,7 +12,7 @@ void ColoredSquare_constructor (ColoredSquare *this,
a, a,
color); color);
Square_constructor ((Square *) this, a); Square_constructor ((Square *) this, a);
((ColoredSquare *) this)->color = color; this->color = color;
} }
void ColoredSquare_copy (ColoredSquare *to, ColoredSquare *from) void ColoredSquare_copy (ColoredSquare *to, ColoredSquare *from)
@ -21,7 +21,7 @@ void ColoredSquare_copy (ColoredSquare *to, ColoredSquare *from)
(unsigned long) to, (unsigned long) to,
(unsigned long) from); (unsigned long) from);
Square_copy ((Square *) to, (Square *) from); Square_copy ((Square *) to, (Square *) from);
((ColoredSquare *) to)->color = ((ColoredSquare *) from)->color; to->color = from->color;
} }
ColoredSquare* ColoredSquare_clone (ColoredSquare *this) ColoredSquare* ColoredSquare_clone (ColoredSquare *this)
@ -53,8 +53,8 @@ void ColoredSquare_draw (ColoredSquare *this)
printf ("ColoredSquare_draw (%lu) called\n", printf ("ColoredSquare_draw (%lu) called\n",
(unsigned long) this); (unsigned long) this);
printf ("Drawing ColoredSquare with %f side and %d color\n", printf ("Drawing ColoredSquare with %f side and %d color\n",
((ColoredSquare *) this)->a, this->a,
((ColoredSquare *) this)->color); this->color);
} }
void ColoredSquare_set_color (ColoredSquare *this, int color) void ColoredSquare_set_color (ColoredSquare *this, int color)
@ -63,7 +63,7 @@ void ColoredSquare_set_color (ColoredSquare *this, int color)
(unsigned long) this, (unsigned long) this,
color); color);
((ColoredSquare *) this)->color = color; this->color = color;
} }
/* public */ /* public */
@ -95,7 +95,7 @@ ColoredSquare* ColoredSquare_new (double a, int color)
color, color,
(unsigned long) square); (unsigned long) square);
square->vtable = (ColoredSquare_interface *) &vtable; square->vtable = &vtable;
/*goto end; /*goto end;
err: err:

View File

@ -8,7 +8,7 @@ void Square_constructor (Square *this, double a)
printf ("Square_constructor (%lu, %f) called\n", printf ("Square_constructor (%lu, %f) called\n",
(unsigned long) this, (unsigned long) this,
a); a);
((Square *) this)->a = a; this->a = a;
} }
void Square_destructor (Square *this) void Square_destructor (Square *this)
@ -22,7 +22,7 @@ void Square_copy (Square *to, Square *from)
printf ("Square_copy (%lu, %lu) called\n", printf ("Square_copy (%lu, %lu) called\n",
(unsigned long) to, (unsigned long) to,
(unsigned long) from); (unsigned long) from);
((Square *) to)->a = ((Square *) from)->a; to->a = from->a;
} }
Square* Square_clone (Square *this) Square* Square_clone (Square *this)
@ -62,12 +62,12 @@ void Square_draw (Square *this)
printf ("Square_draw (%lu) called\n", printf ("Square_draw (%lu) called\n",
(unsigned long) this); (unsigned long) this);
printf ("Drawing Square with %f side\n", printf ("Drawing Square with %f side\n",
((Square *) this)->a); this->a);
} }
double Square_area (Square *this) 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", printf ("Square_area (%lu) called\n",
(unsigned long) this); (unsigned long) this);
printf ("Square_area (%lu) returns %f\n", 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", printf ("Square_resize (%lu, %f) called\n",
(unsigned long) this, (unsigned long) this,
a); a);
((Square *) this)->a = a; this->a = a;
} }
double Square_diag_length (Square *this) double Square_diag_length (Square *this)
@ -123,7 +123,7 @@ Square* Square_new (double a)
a, a,
(unsigned long) square); (unsigned long) square);
square->vtable = (Square_interface *) &vtable; square->vtable = &vtable;
/*goto end; /*goto end;
err: err: