diff options
Diffstat (limited to 'FEAST/MIToolbox/util.c')
-rw-r--r-- | FEAST/MIToolbox/util.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/FEAST/MIToolbox/util.c b/FEAST/MIToolbox/util.c new file mode 100644 index 0000000..d9d7517 --- /dev/null +++ b/FEAST/MIToolbox/util.c @@ -0,0 +1,14 @@ +#include <string.h> +#include <errno.h> + +#include "MIToolbox.h" + +// a wrapper for calloc that checks if it's allocated +void *safe_calloc(size_t nelem, size_t elsize) { + void *allocated = UNSAFE_CALLOC_FUNC(nelem, elsize); + if(allocated == NULL) { + fprintf(stderr, "Error: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + return allocated; +} |