5 #include "cgds/safe_alloc.h"
7 void* safe_malloc(size_t size
)
9 void* res
= malloc(size
);
12 fprintf(stderr
, "Error: unable to allocate memory\n");
18 void* safe_calloc(size_t count
, size_t size
)
20 void* res
= calloc(count
, size
);
23 fprintf(stderr
, "Error: unable to allocate memory\n");
29 void* safe_realloc(void* ptr
, size_t size
)
31 void* res
= realloc(ptr
, size
);
34 fprintf(stderr
, "Error: unable to reallocate memory\n");
40 void safe_free(void* ptr
)