From fa21ff4813cde3fc60803c8faf40d9612c0a0d1a Mon Sep 17 00:00:00 2001 From: "Thierry M." Date: Wed, 4 Mar 2026 13:40:05 +0100 Subject: [PATCH] use CStr .to_str() method MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Co-authored-by: Bennet Bleßmann <3877590+Skgland@users.noreply.github.com> --- src/machine/system_calls.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index 4b38c90b..946380bc 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -5125,9 +5125,7 @@ impl Machine { unify!(self.machine_st, return_value, struct_value); } Value::CString(cstr) => { - let bytes = cstr.to_bytes(); - - let str_cell = match std::str::from_utf8(bytes) { + let str_cell = match cstr.to_str() { Ok(valid_str) => resource_error_call_result!( self.machine_st, self.machine_st.heap.allocate_cstr(valid_str) -- 2.54.0