]> Repositorios git - scryer-prolog.git/commitdiff
use CStr .to_str() method
authorThierry M. <[email protected]>
Wed, 4 Mar 2026 12:40:05 +0000 (13:40 +0100)
committerThierry Marianne <[email protected]>
Wed, 4 Mar 2026 13:00:44 +0000 (14:00 +0100)
Co-authored-by: Bennet Bleßmann <[email protected]>
src/machine/system_calls.rs

index 4b38c90b6a39aef6a21bfc1a7b718c3381be792f..946380bcb3996bdfd95412c238c8c3bb57c9212f 100644 (file)
@@ -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)