Code

utils error, strbuf: Added sdb_error_chomp(), sdb_strbuf_chomp().
[sysdb.git] / src / include / utils / strbuf.h
index 7b159edb6971a2509051efd2be2c5d6296ed4df9..302cfdde4bb71839b94d86b47c57fe194b9647f2 100644 (file)
@@ -93,6 +93,18 @@ sdb_strbuf_vsprintf(sdb_strbuf_t *strbuf, const char *fmt, va_list ap);
 ssize_t
 sdb_strbuf_sprintf(sdb_strbuf_t *strbuf, const char *fmt, ...);
 
+/*
+ * 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