summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
new file mode 100644
index 0000000..0432a57
--- /dev/null
+++ b/src/util.h
@@ -0,0 +1,21 @@
+/* Copyright 2016 Luke Shumaker */
+
+#pragma once
+
+#include <signal.h> /* for sig_atomic_t */
+#include <string.h> /* for memset(3) */
+#include <stdbool.h>
+
+#define UNUSED __attribute__((__unused__))
+#define ZERO(x) memset(&(x), 0, sizeof(x))
+
+#ifndef _
+#define _(str) str
+#endif
+
+#define log(...) error(0, 0, __VA_ARGS__)
+#define debug(...) error(0, 0, __VA_ARGS__)
+
+void *xrealloc(void *ptr, size_t size);
+bool is_numeric(const char *str);
+int get_fd(const char *addr);