Add CHECK_POINTER_HAS_TYPE macro, and use it to make *_data macros safer.