core: error: update b_stringstream usage to use b_stream interface

This commit is contained in:
2025-10-24 12:33:23 +01:00
parent a5762e537b
commit 1d9549c0c2

View File

@@ -219,10 +219,10 @@ struct b_error *z__b_error_create_string(
error->err_caused_by = caused_by;
if (description) {
b_stringstream desc;
b_stringstream_begin_dynamic(&desc);
b_stringstream_addvf(&desc, description, arg);
error->err_description = b_stringstream_end(&desc);
b_stringstream *desc = b_stringstream_create();
b_stream_write_vfmt(desc, NULL, description, arg);
error->err_description = b_stringstream_steal(desc);
b_stringstream_unref(desc);
}
return z__b_error_propagate(error, file, line, func);
@@ -738,26 +738,27 @@ static void get_error_id(
error_name = b_error_vendor_get_status_code_name(vendor, code);
}
b_stringstream id;
b_stringstream_begin(&id, out, max);
b_stringstream *id = b_stringstream_create_with_buffer(out, max);
if (vendor_name) {
b_stringstream_add(&id, vendor_name);
b_stream_write_string(id, vendor_name, NULL);
}
if (error_name) {
if (vendor_name) {
b_stringstream_add(&id, ".");
b_stream_write_string(id, ".", NULL);
}
b_stringstream_add(&id, error_name);
b_stream_write_string(id, error_name, NULL);
} else {
if (vendor_name) {
b_stringstream_add(&id, "#");
b_stream_write_string(id, "#", NULL);
}
b_stringstream_addf(&id, "%ld", code);
b_stream_write_fmt(id, NULL, "%ld", code);
}
b_stringstream_unref(id);
}
static void print_template_parameter(