summaryrefslogtreecommitdiff
path: root/src/shared.h
blob: ac214f784de95b23f1ed9e2a88824e9337c1dc13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef __VXGG_REWRITE___SHARED_H___3880294315821___
#define __VXGG_REWRITE___SHARED_H___3880294315821___

#include <stddef.h>

// Defines how `xcalloc()` should exit. `___VXGG___XCALLOC_EXIT_ON_ERROR___ > 0` calls `error()`, and thus functions registered with
// `atexit()` and `on_exit()`. `___VXGG___XCALLOC_EXIT_ON_ERROR___ <= 0` calls `abort()` on error. `xcalloc()` will ALWAYS 'abort',
// doing otherwise defeats the purpose of the function
#define ___VXGG___XCALLOC_EXIT_ON_ERROR___ 1

// `calloc()` with error checking. Calls `error()` or `abort()` on error depending on the value of `___VXGG___XCALLOC_EXIT_ON_ERROR___`
void* xcalloc(size_t nmemb, size_t size);

#endif