summaryrefslogtreecommitdiff
path: root/src/jansson/strbuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/jansson/strbuffer.h')
-rw-r--r--src/jansson/strbuffer.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/jansson/strbuffer.h b/src/jansson/strbuffer.h
new file mode 100644
index 0000000..23f8fff
--- /dev/null
+++ b/src/jansson/strbuffer.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org>
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef STRBUFFER_H
+#define STRBUFFER_H
+
+typedef struct {
+ char *value;
+ size_t length; /* bytes used */
+ size_t size; /* bytes allocated */
+} strbuffer_t;
+
+int strbuffer_init(strbuffer_t *strbuff);
+void strbuffer_close(strbuffer_t *strbuff);
+
+void strbuffer_clear(strbuffer_t *strbuff);
+
+const char *strbuffer_value(const strbuffer_t *strbuff);
+char *strbuffer_steal_value(strbuffer_t *strbuff);
+
+int strbuffer_append(strbuffer_t *strbuff, const char *string);
+int strbuffer_append_byte(strbuffer_t *strbuff, char byte);
+int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size);
+
+char strbuffer_pop(strbuffer_t *strbuff);
+
+#endif