* @def BU_CKMAG(ptr,magic,string) * * Macros to check and validate a structure pointer, given that * the first entry in the structure is a magic number. */ #ifdef NO_BOMBING_MACROS # define BU_CKMAG(_ptr, _magic, _str) # define BU_CKMAG_TCL(_interp, _ptr, _magic, _str) #else # define BU_CKMAG(_ptr, _magic, _str) \ if( !(ptr) || ((~_ptr) & (_ptr)) || \ ( ((size_t)(_ptr)) & (sizeof(long)-1) ) || \ *((unsigned long *)(_ptr)) != (unsigned long)(_magic) ) { \ bu_badmagic( (long *)(_ptr), (unsigned long)_magic, _str, __FILE } \ return; # define BU_CKMAG_TCL(_interp, _ptr, _magic, _str) \ if( !(_ptr) || ( ((size_t)(_ptr)) & (sizeof(long)-1) ) || \ *((long *)(_ptr)) != (_magic) ) { \ bu_badmagic_tcl( (_interp), (long *)(_ptr), (unsigned long)_magi return TCL_ERROR; \ } \ return;