From 833cb417608eb138d3a9b99dc995c5c1aeffd1cd Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Sun, 30 Mar 2025 23:13:35 -0500 Subject: Create encryption functions that actually work --- src/shared.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/shared.h') diff --git a/src/shared.h b/src/shared.h index 718bbf2..7d2db27 100644 --- a/src/shared.h +++ b/src/shared.h @@ -29,14 +29,16 @@ exit(EXIT_FAILURE); /* Makes gcc happy */\ } while (0) +#define ERROR(status, errnum, format, ...) do {error((status), (errnum), (format)__VA_ARGS__); exit((status));} while (0) + // `malloc()` with error checking. Calls `exit()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` void * xmalloc(size_t size); // `calloc()` with error checking. Calls `exit()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` -void* xcalloc(size_t nmemb, size_t size); +void * xcalloc(size_t nmemb, size_t size); // `reallocarray()` with error checking. Calls `exit()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` -void* xreallocarray(void *ptr, size_t nmemb, size_t size); +void * xreallocarray(void *ptr, size_t nmemb, size_t size); // Read the entire contents of a file descriptor into a malloc()'ed buffer int rwbuf(char **str, unsigned long int initsize, int fd); @@ -45,6 +47,6 @@ int rwbuf(char **str, unsigned long int initsize, int fd); int wwbuf(int fd, const unsigned char *buf, int len); // `dirname()` reimplementation that returns a malloc()'ed string. According to the `x___` naming scheme, exits/aborts on alloc error. -char *xdirname(const char * const path); +char * xdirname(const char * const path); #endif \ No newline at end of file -- cgit v1.2.3