From f8e94a1179633799579a09dce1841f41e3b73f05 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Mon, 6 Jan 2025 18:34:13 -0600 Subject: Start work on encryption --- src/shared.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/shared.h') diff --git a/src/shared.h b/src/shared.h index ac214f7..fef19ca 100644 --- a/src/shared.h +++ b/src/shared.h @@ -2,13 +2,23 @@ #define __VXGG_REWRITE___SHARED_H___3880294315821___ #include +#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 +// Defines how `x___alloc()` functions 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___` +// `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); +// `reallocarray()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XCALLOC_EXIT_ON_ERROR___` +void* xreallocarray(void *ptr, size_t nmemb, size_t size); + +// `vsprintf()`, but reallocates enough room for the resulting string before writing to `str` +int vsaprintf(char **str, const char *format, va_list ap); + +// `sprintf()`, but reallocates enough room for the resulting string before writing to `str` +int saprintf(char **str, const char *format, ...); + #endif \ No newline at end of file -- cgit v1.2.3