vsprintf: split out '%p' handling logic