From 97713275dc87ea1d0afa4fd6bc49f695ad40efc0 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Fri, 28 Mar 2025 17:23:55 -0500 Subject: Create xalloc function and wrappers, fix XALLOC_EXIT usages to comply with ISO C99 --- src/shared.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/shared.h') diff --git a/src/shared.h b/src/shared.h index b9e7bcd..718bbf2 100644 --- a/src/shared.h +++ b/src/shared.h @@ -29,10 +29,13 @@ exit(EXIT_FAILURE); /* Makes gcc happy */\ } while (0) -// `calloc()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` +// `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); -// `reallocarray()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` +// `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); // Read the entire contents of a file descriptor into a malloc()'ed buffer -- cgit v1.2.3