summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-03-11 19:34:18 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-03-11 19:34:18 -0500
commita0a8aaf5170eab149ee0fed4d7846e0df856a2e4 (patch)
tree8e301f0c0279bdd5b592f1c63004b650fab3470f /util.c
parent77f1df1a250d958317c930e6f3a36edf42f11d09 (diff)
split into separate executables
Diffstat (limited to 'util.c')
-rw-r--r--util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/util.c b/util.c
new file mode 100644
index 0000000..22b6dc6
--- /dev/null
+++ b/util.c
@@ -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;
+}