Added macro to prevent code duplication.
Changed existing safepointers to a more general way.

Signed-off-by: IUnknown68 <arne@salsitasoft.com>