summaryrefslogtreecommitdiff
path: root/src/shared.h
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2025-01-11 16:57:57 -0600
committer@syxhe <https://t.me/syxhe>2025-01-11 16:57:57 -0600
commitd8e03b1a1d929f6afeac72d475183d0218656b48 (patch)
tree48cc8444f4489ec7e32b8e4a6fc372b051b9cea1 /src/shared.h
parent2db78bbbfa11f334c09b15c3918f3cda172b637c (diff)
First pass at genpassword
Diffstat (limited to 'src/shared.h')
-rw-r--r--src/shared.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/shared.h b/src/shared.h
index 05ab58c..5894b41 100644
--- a/src/shared.h
+++ b/src/shared.h
@@ -4,17 +4,17 @@
4#include <stddef.h> 4#include <stddef.h>
5#include <stdarg.h> 5#include <stdarg.h>
6 6
7#define STATICARRAY_SIZE(arr) (sizeof((arr))/sizeof((arr)[0])) 7#define STATICARR_SIZE(arr) (sizeof((arr))/sizeof((arr)[0]))
8 8
9// Defines how `x___alloc()` functions should exit. `___VXGG___XCALLOC_EXIT_ON_ERROR___ > 0` calls `error()`, and thus functions 9// Defines how `x___alloc()` functions should exit. `___VXGG___XALLOC_EXIT_ON_ERROR___ > 0` calls `error()`, and thus functions
10// registered with `atexit()` and `on_exit()`. `___VXGG___XCALLOC_EXIT_ON_ERROR___ <= 0` calls `abort()` on error. `xcalloc()` 10// registered with `atexit()` and `on_exit()`. `___VXGG___XALLOC_EXIT_ON_ERROR___ <= 0` calls `abort()` on error. `x___alloc()`
11// will ALWAYS 'abort', doing otherwise defeats the purpose of the function 11// type functions will ALWAYS 'abort', doing otherwise defeats the purpose of the function type
12#define ___VXGG___XCALLOC_EXIT_ON_ERROR___ 1 12#define ___VXGG___XALLOC_EXIT_ON_ERROR___ 1
13 13
14// `calloc()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XCALLOC_EXIT_ON_ERROR___` 14// `calloc()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___`
15void* xcalloc(size_t nmemb, size_t size); 15void* xcalloc(size_t nmemb, size_t size);
16 16
17// `reallocarray()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XCALLOC_EXIT_ON_ERROR___` 17// `reallocarray()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___`
18void* xreallocarray(void *ptr, size_t nmemb, size_t size); 18void* xreallocarray(void *ptr, size_t nmemb, size_t size);
19 19
20#if !defined _GNU_SOURCE 20#if !defined _GNU_SOURCE