Code

utils/strbuf: Added SDB_STRBUF_STR.
[sysdb.git] / src / include / utils / strbuf.h
index 5e9913d1d6217a8753ebc131933ab0c93910f38c..a9e915537c9d97c03fd94310cfb58b66a3041c34 100644 (file)
@@ -45,6 +45,13 @@ extern "C" {
 
 typedef struct sdb_strbuf sdb_strbuf_t;
 
+/*
+ * SDB_STRBUF_STR:
+ * Return a tuple of a character array and its length representing the content
+ * of the string buffer.
+ */
+#define SDB_STRBUF_STR(buf) sdb_strbuf_string(buf), sdb_strbuf_len(buf)
+
 /*
  * sdb_strbuf_create, sdb_strbuf_destroy:
  * Allocate / deallocate string buffer objects. The initial size of a newly
@@ -104,8 +111,8 @@ sdb_strbuf_sprintf(sdb_strbuf_t *strbuf, const char *fmt, ...)
  * 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.
+ * function calls with any of the printf-style function works fine but the
+ * entire buffer content should then be treated as arbitrary bytes.
  *
  * Returns:
  *  - the number of bytes written