mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 21:12:56 +03:00
make asserting malloc into a #define
This commit is contained in:
parent
9733f6ce66
commit
75dce9eefc
@ -90,5 +90,9 @@
|
|||||||
} while (0)
|
} while (0)
|
||||||
/* c3_malloc(): asserting malloc
|
/* c3_malloc(): asserting malloc
|
||||||
*/
|
*/
|
||||||
void*
|
#define c3_malloc(s) ({ \
|
||||||
c3_malloc(size_t s);
|
void* rut = malloc(s); \
|
||||||
|
if ( 0 == rut ) { \
|
||||||
|
c3_assert(!"memory lost"); \
|
||||||
|
} \
|
||||||
|
rut;})
|
||||||
|
10
v/main.c
10
v/main.c
@ -256,16 +256,6 @@ static void _main_cont(void *arg1, void *arg2, void *arg3)
|
|||||||
siglongjmp(Signal_buf, 1);
|
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
|
static void
|
||||||
overflow_handler(int emergency, stackoverflow_context_t scp)
|
overflow_handler(int emergency, stackoverflow_context_t scp)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user