aboutsummaryrefslogtreecommitdiffhomepage
path: root/util/util.h
diff options
context:
space:
mode:
authorGravatar David Bremner <david@tethera.net>2014-03-29 14:53:17 -0300
committerGravatar David Bremner <david@tethera.net>2014-04-12 07:59:44 -0300
commit85d9219a62c23c3ff58b42a63b65390526b89b6b (patch)
treefbf5b430c91b6ffa6b2c773c86184790232b2fe1 /util/util.h
parent3c13bc0321baaf340663779d6fce2b1f34c1c2c3 (diff)
util: add gz_readline
The idea is to provide a more or less drop in replacement for readline to read from zlib/gzip streams. Take the opportunity to replace malloc with talloc.
Diffstat (limited to 'util/util.h')
-rw-r--r--util/util.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/util/util.h b/util/util.h
new file mode 100644
index 00000000..d12fadb4
--- /dev/null
+++ b/util/util.h
@@ -0,0 +1,29 @@
+#ifndef _UTIL_H
+#define _UTIL_H
+
+typedef enum util_status {
+ /**
+ * No error occurred.
+ */
+ UTIL_SUCCESS = 0,
+ /**
+ * Out of memory.
+ */
+ UTIL_OUT_OF_MEMORY,
+ /**
+ * End of stream reached while attempting to read.
+ */
+ UTIL_EOF,
+ /**
+ * Low level error occured, consult errno.
+ */
+ UTIL_ERRNO,
+ /**
+ * Zlib error occured, call gzerror for details.
+ */
+ UTIL_GZERROR
+} util_status_t;
+
+const char *
+util_error_string (util_status_t status);
+#endif