diff options
| author | @syxhe <https://t.me/syxhe> | 2024-12-26 21:42:53 -0600 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2024-12-26 21:42:53 -0600 |
| commit | 03c5fce0220d3e5d02d320f925a3b9401a397729 (patch) | |
| tree | db27acac8fceee17cace9fa05ddd24fa6fe23cf9 /src/shared.h | |
| parent | f7ded3958a7f3bea16e2c8be55f159f34a45ca61 (diff) | |
Put some notes down
Diffstat (limited to 'src/shared.h')
| -rw-r--r-- | src/shared.h | 14 |
1 files changed, 14 insertions, 0 deletions
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 @@ | |||
| 1 | #ifndef __VXGG_REWRITE___SHARED_H___3880294315821___ | ||
| 2 | #define __VXGG_REWRITE___SHARED_H___3880294315821___ | ||
| 3 | |||
| 4 | #include <stddef.h> | ||
| 5 | |||
| 6 | // Defines how `xcalloc()` should exit. `___VXGG___XCALLOC_EXIT_ON_ERROR___ > 0` calls `error()`, and thus functions registered with | ||
| 7 | // `atexit()` and `on_exit()`. `___VXGG___XCALLOC_EXIT_ON_ERROR___ <= 0` calls `abort()` on error. `xcalloc()` will ALWAYS 'abort', | ||
| 8 | // doing otherwise defeats the purpose of the function | ||
| 9 | #define ___VXGG___XCALLOC_EXIT_ON_ERROR___ 1 | ||
| 10 | |||
| 11 | // `calloc()` with error checking. Calls `error()` or `abort()` on error depending on the value of `___VXGG___XCALLOC_EXIT_ON_ERROR___` | ||
| 12 | void* xcalloc(size_t nmemb, size_t size); | ||
| 13 | |||
| 14 | #endif \ No newline at end of file | ||
