From 9c45e9c7df1efa5bc1c8e73b6eaef4726b828d3e Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Tue, 4 Feb 2025 19:59:47 +0100 Subject: add span type --- lib/nes/common/string-builder.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/nes/common/string-builder.cc') diff --git a/lib/nes/common/string-builder.cc b/lib/nes/common/string-builder.cc index efc1326..087f0d4 100644 --- a/lib/nes/common/string-builder.cc +++ b/lib/nes/common/string-builder.cc @@ -2,22 +2,21 @@ namespace nes { - string_builder::string_builder(char* buffer, u32 buffer_length) + string_builder::string_builder(span const buffer) : buffer_{ buffer } - , buffer_length_{ buffer_length } { } auto string_builder::append_char(char const value) -> string_builder& { - if (actual_length_ == buffer_length_) + if (length_ == buffer_.get_length()) { is_good_ = false; return *this; } - buffer_[actual_length_] = value; - actual_length_ += 1; + buffer_[length_] = value; + length_ += 1; return *this; } -- cgit v1.3.1