Unnecessary casts removed
This commit is contained in:
parent
47b5fa044d
commit
2bf8698183
|
@ -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:
|
||||
|
|
12
Square.c
12
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:
|
||||
|
|
Loading…
Reference in New Issue