common: replace reference to b_strv_builder with b_stringstream

This commit is contained in:
2024-12-15 22:35:54 +00:00
parent 10c03c4b74
commit 08f08df6e4

View File

@@ -1,6 +1,7 @@
#include <ivy/ident.h>
#include <blue/core/queue.h>
#include <blue/core/stringstream.h>
#include <blue/object/string.h>
#include <ivy/ident.h>
#include <stdlib.h>
#include <string.h>
@@ -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;
}
}