Skip to content

Commit

Permalink
crates/sel4-microkit: Improve style
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed Feb 28, 2024
1 parent 25e7f8d commit 5f492e4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/sel4-microkit/base/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@ pub fn pd_is_passive() -> bool {
/// Returns the name of this projection domain without converting to unicode.
pub fn pd_name_bytes() -> &'static [u8] {
let all_bytes = maybe_extern_var!(microkit_name: [u8; 16] = [0; 16]);
match core::ffi::CStr::from_bytes_until_nul(all_bytes) {
Ok(cstr) => cstr.to_bytes(),
Err(_) => all_bytes,
}
let n = all_bytes.iter().take_while(|b| **b != 0).count();
&all_bytes[..n]
}

/// Returns the name of this projection domain.
Expand Down

0 comments on commit 5f492e4

Please sign in to comment.