strbuf: make length for strbuf_add_string() optional

This commit is contained in:
Yu Watanabe
2024-06-12 18:19:29 +09:00
parent 34d4e6f32a
commit 3bc70f104e
5 changed files with 22 additions and 20 deletions
+4 -1
View File
@@ -105,13 +105,16 @@ static void bubbleinsert(struct strbuf_node *node,
}
/* add string, return the index/offset into the buffer */
ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len) {
ssize_t strbuf_add_string_full(struct strbuf *str, const char *s, size_t len) {
uint8_t c;
ssize_t off;
assert(str);
assert(s || len == 0);
if (len == SIZE_MAX)
len = strlen(s);
if (!str->root)
return -EINVAL;