From 03c5fce0220d3e5d02d320f925a3b9401a397729 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Thu, 26 Dec 2024 21:42:53 -0600 Subject: Put some notes down --- src/shared.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/shared.h (limited to 'src/shared.h') diff --git a/src/shared.h b/src/shared.h new file mode 100644 index 0000000..ac214f7 --- /dev/null +++ b/src/shared.h @@ -0,0 +1,14 @@ +#ifndef __VXGG_REWRITE___SHARED_H___3880294315821___ +#define __VXGG_REWRITE___SHARED_H___3880294315821___ + +#include + +// 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 \ No newline at end of file -- cgit v1.2.3