diff --git a/include/c/defs.h b/include/c/defs.h index ef90939bd6..8051c23cf9 100644 --- a/include/c/defs.h +++ b/include/c/defs.h @@ -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;}) diff --git a/v/main.c b/v/main.c index b179a7ea7d..2b6afcac4d 100644 --- a/v/main.c +++ b/v/main.c @@ -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) {