Cleanup pointer casting in code to use macros.