follow-up eliminating more as casts
This commit is contained in:
@@ -5,7 +5,7 @@ pub fn split(line: &mut [u8]) -> Option<passwd> {
|
||||
let mut parts = line.split_mut(|&c| c == b'\0');
|
||||
Some(passwd {
|
||||
pw_name: parts.next()?.as_mut_ptr().cast::<c_char>(),
|
||||
pw_passwd: c"x".as_ptr().cast::<c_char>() as *mut c_char,
|
||||
pw_passwd: c"x".as_ptr().cast::<c_char>().cast_mut(),
|
||||
pw_uid: parsed(parts.next())?,
|
||||
pw_gid: parsed(parts.next())?,
|
||||
pw_gecos: parts.next()?.as_mut_ptr().cast::<c_char>(),
|
||||
|
||||
@@ -22,8 +22,9 @@ fn dup_read<T>(fd: c_int, name: &str, t: &mut T) -> syscall::Result<usize> {
|
||||
|
||||
let size = mem::size_of::<T>();
|
||||
|
||||
let bytes = dup
|
||||
.read(unsafe { slice::from_raw_parts_mut(core::ptr::from_mut::<T>(t) as *mut u8, size) })?;
|
||||
let bytes = dup.read(unsafe {
|
||||
slice::from_raw_parts_mut(core::ptr::from_mut::<T>(t).cast::<u8>(), size)
|
||||
})?;
|
||||
|
||||
Ok(bytes / size)
|
||||
}
|
||||
@@ -35,7 +36,7 @@ fn dup_write<T>(fd: c_int, name: &str, t: &T) -> Result<usize> {
|
||||
let size = mem::size_of::<T>();
|
||||
|
||||
let bytes = dup
|
||||
.write(unsafe { slice::from_raw_parts(core::ptr::from_ref::<T>(t) as *const u8, size) })?;
|
||||
.write(unsafe { slice::from_raw_parts(core::ptr::from_ref::<T>(t).cast::<u8>(), size) })?;
|
||||
|
||||
Ok(bytes / size)
|
||||
}
|
||||
|
||||
+2
-2
@@ -665,7 +665,7 @@ impl Linker {
|
||||
|
||||
// Unmap just the TCB page.
|
||||
Sys::munmap(
|
||||
core::ptr::from_mut::<Tcb>(new_tcb) as *mut c_void,
|
||||
core::ptr::from_mut::<Tcb>(new_tcb).cast::<c_void>(),
|
||||
syscall::PAGE_SIZE,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -698,7 +698,7 @@ impl Linker {
|
||||
drop(_guard);
|
||||
(
|
||||
new_tcb,
|
||||
core::ptr::from_mut::<Tcb>(old_tcb) as *mut c_void,
|
||||
core::ptr::from_mut::<Tcb>(old_tcb).cast::<c_void>(),
|
||||
thr_fd,
|
||||
)
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{c_str::CStr, header::stdlib::getenv, platform::types::c_char};
|
||||
use syscall::{EIO, ENOENT, Error, Result, flag::*};
|
||||
|
||||
pub const LIBC_SCHEME: &'static str = "libc:";
|
||||
pub const LIBC_SCHEME: &str = "libc:";
|
||||
|
||||
const ENV_MAX_LEN: i32 = i32::MAX;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user