Skip to content

Commit

Permalink
Update c_str.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuang authored Dec 15, 2023
1 parent de686cb commit d031795
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl CStr {
/// * The memory pointed to by `ptr` must contain a valid nul terminator at the
/// end of the string.
///
/// * `ptr` must be [valid] for reads of bytes up to and including the null terminator.
/// * `ptr` must be [valid] for reads of bytes up to and including the nul terminator.
/// This means in particular:
///
/// * The entire memory range of this `CStr` must be contained within a single allocated object!
Expand Down Expand Up @@ -415,7 +415,7 @@ impl CStr {
let mut i = bytes.len().saturating_sub(1);
assert!(!bytes.is_empty() && bytes[i] == 0, "input was not nul-terminated");

// Ending null byte exists, skip to the rest.
// Ending nul byte exists, skip to the rest.
while i != 0 {
i -= 1;
let byte = bytes[i];
Expand Down

0 comments on commit d031795

Please sign in to comment.