From 1d9549c0c2bf297644f01418778d671db5505f03 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Fri, 24 Oct 2025 12:33:23 +0100 Subject: [PATCH] core: error: update b_stringstream usage to use b_stream interface --- core/error.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/core/error.c b/core/error.c index 19bb292..e749b9f 100644 --- a/core/error.c +++ b/core/error.c @@ -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(