r4052: fixed a bunch of code to use the type safe _p allocation macros