aboutsummaryrefslogtreecommitdiff
path: root/FEAST/MIToolbox/util.c
blob: d9d75177885072f4590e7794d656b85000d69f11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
}