index 900a4530511020ae9c5d8374b065c943922c23ad..5e9913d1d6217a8753ebc131933ab0c93910f38c 100644 (file)
* - a negative value on error
*/
ssize_t
-sdb_strbuf_vappend(sdb_strbuf_t *strbuf, const char *fmt, va_list ap);
+sdb_strbuf_vappend(sdb_strbuf_t *strbuf, const char *fmt, va_list ap)
+ __attribute__((format(printf, 2, 0)));
ssize_t
-sdb_strbuf_append(sdb_strbuf_t *strbuf, const char *fmt, ...);
+sdb_strbuf_append(sdb_strbuf_t *strbuf, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
/*
* sdb_strbuf_vsprintf, sdb_strbuf_sprintf:
* - a negative value on error
*/
ssize_t
-sdb_strbuf_vsprintf(sdb_strbuf_t *strbuf, const char *fmt, va_list ap);
+sdb_strbuf_vsprintf(sdb_strbuf_t *strbuf, const char *fmt, va_list ap)
+ __attribute__((format(printf, 2, 0)));
ssize_t
-sdb_strbuf_sprintf(sdb_strbuf_t *strbuf, const char *fmt, ...);
+sdb_strbuf_sprintf(sdb_strbuf_t *strbuf, const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
/*
* sdb_strbuf_memcpy, sdb_strbuf_memappend:
void
sdb_strbuf_skip(sdb_strbuf_t *strbuf, size_t offset, size_t n);
+/*
+ * sdb_strbuf_clear:
+ * Clear the buffer but do not deallocate memory.
+ */
+void
+sdb_strbuf_clear(sdb_strbuf_t *strbuf);
+
/*
* sdb_strbuf_string:
* Returns the content of the string buffer. The caller may not modify the
size_t
sdb_strbuf_len(sdb_strbuf_t *strbuf);
+/*
+ * sdb_strbuf_cap:
+ * Returns the current capacity of the string buffer. It describes the max
+ * length of the buffer's content (including terminating nul byte) that may be
+ * stored in the buffer without resizing it.
+ */
+size_t
+sdb_strbuf_cap(sdb_strbuf_t *strbuf);
+
#ifdef __cplusplus
} /* extern "C" */
#endif