From 08f08df6e43e64fbd544e18abf767a6923c57044 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 15 Dec 2024 22:35:54 +0000 Subject: [PATCH] common: replace reference to b_strv_builder with b_stringstream --- common/ident.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/common/ident.c b/common/ident.c index d63c5d0..776d4ba 100644 --- a/common/ident.c +++ b/common/ident.c @@ -1,6 +1,7 @@ -#include #include +#include #include +#include #include #include @@ -23,9 +24,10 @@ void ivy_ident_destroy(struct ivy_ident *ident) b_queue_iterator_begin(&ident->id_parts, &it); while (b_queue_iterator_is_valid(&it)) { - struct ivy_ident_part *part = b_unbox(struct ivy_ident_part, it.entry, p_entry); + struct ivy_ident_part *part + = b_unbox(struct ivy_ident_part, it.entry, p_entry); b_queue_iterator_erase(&it); - + free(part->p_str); free(part); } @@ -49,21 +51,22 @@ void ivy_ident_add_part(struct ivy_ident *ident, const char *s) size_t ivy_ident_to_string(const struct ivy_ident *ident, char *out, size_t max) { - b_strv_builder strv; - b_strv_builder_begin(&strv, out, max); + b_stringstream strv; + b_stringstream_begin(&strv, out, max); int i = 0; b_queue_iterator it = {0}; b_queue_foreach (&it, &ident->id_parts) { if (i > 0) { - b_strv_builder_add(&strv, "."); + b_stringstream_add(&strv, "."); } - struct ivy_ident_part *part = b_unbox(struct ivy_ident_part, it.entry, p_entry); - b_strv_builder_add(&strv, part->p_str); + struct ivy_ident_part *part + = b_unbox(struct ivy_ident_part, it.entry, p_entry); + b_stringstream_add(&strv, part->p_str); i++; } /* TODO return string length. */ return 0; -} \ No newline at end of file +}