make asserting malloc into a #define

This commit is contained in:
~hatteb-mitlyd 2014-04-03 14:36:25 -07:00
parent 9733f6ce66
commit 75dce9eefc
2 changed files with 6 additions and 12 deletions

View File

@ -90,5 +90,9 @@
} while (0)
/* c3_malloc(): asserting malloc
*/
void*
c3_malloc(size_t s);
#define c3_malloc(s) ({ \
void* rut = malloc(s); \
if ( 0 == rut ) { \
c3_assert(!"memory lost"); \
} \
rut;})

View File

@ -256,16 +256,6 @@ static void _main_cont(void *arg1, void *arg2, void *arg3)
siglongjmp(Signal_buf, 1);
}
void*
c3_malloc(size_t s)
{
void* rut = malloc(s);
if ( u2_nul == rut ) {
c3_assert(!"memory lost");
}
return rut;
}
static void
overflow_handler(int emergency, stackoverflow_context_t scp)
{