index 7b159edb6971a2509051efd2be2c5d6296ed4df9..6ad9e1e481fa84d7e1c0dff4f26b571159859118 100644 (file)
ssize_t
sdb_strbuf_sprintf(sdb_strbuf_t *strbuf, const char *fmt, ...);
+/*
+ * sdb_strbuf_memcpy, sdb_strbuf_memappend:
+ * Copy or a append a memory area to the buffer. These functions do not
+ * interpret any information in the data pointer (including \0 bytes).
+ *
+ * These functions may be used to handle arbitrary byte arrays. Mixing these
+ * function calls with any of the printf-style function works but will usually
+ * lead to arbitrary behavior.
+ *
+ * Returns:
+ * - the number of bytes written
+ * - a negative value on error
+ */
+ssize_t
+sdb_strbuf_memcpy(sdb_strbuf_t *strbuf, const void *data, size_t n);
+ssize_t
+sdb_strbuf_memappend(sdb_strbuf_t *strbuf, const void *data, size_t n);
+
+/*
+ * sdb_strbuf_chomp:
+ * Remove all consecutive newline characters from the end of the string buffer
+ * content.
+ *
+ * Returns:
+ * - the number of bytes removed
+ * - a negative value on error
+ */
+ssize_t
+sdb_strbuf_chomp(sdb_strbuf_t *strbuf);
+
/*
* sdb_strbuf_string:
* Returns the content of the string buffer. The caller may not modify the