1 // (C) Copyright Vesa Karvonen 2004.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE.)
6 #include "checked_malloc.h"
8 #if !defined(CHECKED_MALLOC_NO_GC)
12 #define GC_MALLOC malloc
13 #define GC_INIT() ((void)0)
16 void* checked_malloc(ptrdiff_t size
) {
17 static _Bool inited
= 0;
24 ERROR_exit("Negative size of %td bytes specified to checked_malloc.", size
);
25 void* result
= GC_MALLOC(size
);
27 ERROR_exit("Allocation of %td bytes failed.", size
);