diff options
Diffstat (limited to 'src/shared.h')
| -rw-r--r-- | src/shared.h | 7 |
1 files changed, 5 insertions, 2 deletions
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 @@ | |||
| 29 | exit(EXIT_FAILURE); /* Makes gcc happy */\ | 29 | exit(EXIT_FAILURE); /* Makes gcc happy */\ |
| 30 | } while (0) | 30 | } while (0) |
| 31 | 31 | ||
| 32 | // `calloc()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` | 32 | // `malloc()` with error checking. Calls `exit()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` |
| 33 | void * xmalloc(size_t size); | ||
| 34 | |||
| 35 | // `calloc()` with error checking. Calls `exit()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` | ||
| 33 | void* xcalloc(size_t nmemb, size_t size); | 36 | void* xcalloc(size_t nmemb, size_t size); |
| 34 | 37 | ||
| 35 | // `reallocarray()` with error checking. Calls `error()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` | 38 | // `reallocarray()` with error checking. Calls `exit()` or `abort()` on error, depending on the value of `___VXGG___XALLOC_EXIT_ON_ERROR___` |
| 36 | void* xreallocarray(void *ptr, size_t nmemb, size_t size); | 39 | void* xreallocarray(void *ptr, size_t nmemb, size_t size); |
| 37 | 40 | ||
| 38 | // Read the entire contents of a file descriptor into a malloc()'ed buffer | 41 | // Read the entire contents of a file descriptor into a malloc()'ed buffer |
