Remove useless casts and use variable instead of its type in sizeof.