/* salloc++.h Copyright Clinton Staley 1991 * modified by ceh 1992 * ported to snew.h maw apr93 */ #ifndef _SALLOCPP_H_ #define _SALLOCPP_H_ #ifdef MDEBUG #include #include /*#include */ /* * Believe it or not, gnu streambuf.h #defines NULL as (void*)0, which * defintion causes the def of new below to produce compile time errors about * ANSI C forbiding implicit conversion from void *. Therefore, we must * unconditionally redefine NULL, in case stream.h has been included before * this file. This also means that this file must be included *after* stream.h * in order for this fix to work. By convention, therefore, it should be * included after all other includes. (BTW, I must say that this is such a * crock of shit it makes me want to vomit.) */ #ifdef NULL #undef NULL #define NULL 0 #endif extern void* operator new(size_t size, void* ptr); extern void operator delete(void* ptr); extern char *__filename; extern int __linenum; extern void _push_delete_stack(); #define new \ ((__filename = __FILE__) == NULL) ? NULL :\ ((__linenum = __LINE__) == 0) ? NULL : new #define delete __filename = __FILE__, __linenum = __LINE__,\ _push_delete_stack(), delete #define ReportSpace() report_space() #define CheckTromp() chk_tromp(__FILE__, __LINE__) #else #define ReportSpace() #endif extern "C" { #include "salloc.h" } #endif