Skip to content

Commit 283a130

Browse files
committed
Add docs for the new helper functions
1 parent f7c6e0e commit 283a130

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/helpers.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
346346
Ok(())
347347
}
348348

349+
/// Helper function to read an OsString from a null-terminated sequence of bytes, which is what
350+
/// the Unix APIs usually handle.
349351
fn read_os_string_from_c_string(&mut self, scalar: Scalar<Tag>) -> InterpResult<'tcx, OsString> {
350352
let bytes = self.eval_context_mut().memory.read_c_str(scalar)?;
351353
Ok(bytes_to_os_str(bytes)?.into())
352354
}
353355

356+
/// Helper function to write an OsStr as a null-terminated sequence of bytes, which is what
357+
/// the Unix APIs usually handle.
354358
fn write_os_str_to_c_string(&mut self, os_str: &OsStr, ptr: Pointer<Tag>, size: u64) -> InterpResult<'tcx> {
355359
let bytes = os_str_to_bytes(os_str)?;
356360
let len = bytes.len();

0 commit comments

Comments
 (0)