diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-11 19:34:18 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-11 19:34:18 -0500 |
commit | a0a8aaf5170eab149ee0fed4d7846e0df856a2e4 (patch) | |
tree | 8e301f0c0279bdd5b592f1c63004b650fab3470f /util.c | |
parent | 77f1df1a250d958317c930e6f3a36edf42f11d09 (diff) |
split into separate executables
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,17 @@ +#include <stdlib.h> +#include <error.h> +#include <errno.h> + +#include "util.h" + +void *xrealloc(void *ptr, size_t size) +{ + void *ret = realloc(ptr, size); + if (ret == NULL) { + if (ptr==NULL) + error(1, errno, "Could not allocate memory"); + else + error(1, errno, "Could not re-allocate memory"); + } + return ret; +} |