Skip to content

Commit 05d43e7

Browse files
authored
Update syscall.rs
1 parent e9cac4c commit 05d43e7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vm/src/system/syscall.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl SyscallInstruction {
163163
let buffer = memory.read_bytes(buf_addr, count as _)?;
164164

165165
if let Some(logger) = logs {
166-
logger.push(buffer.clone());
166+
logger.push(buffer);
167167
} else {
168168
print!("{}", String::from_utf8_lossy(&buffer));
169169
}
@@ -200,10 +200,11 @@ impl SyscallInstruction {
200200

201201
// Convert buffer to string and split it into marker and function name
202202
let label = String::from_utf8_lossy(&buf).to_string();
203-
let (marker, fn_name) = label
204-
.split_once('#')
205-
.ok_or_else(|| VMErrorKind::InvalidProfileLabel(label.clone()))?
206-
.to_owned();
203+
let (marker, fn_name) = match label.split_once('#') {
204+
Some(parts) => parts,
205+
None => return Err(VMErrorKind::InvalidProfileLabel(label))?,
206+
};
207+
let (marker, fn_name) = (marker.to_owned(), fn_name.to_owned());
207208

208209
// Ensure the marker is either '^' (start) or '$' (end)
209210
if !matches!(marker, "^" | "$") {

0 commit comments

Comments
 (0)