mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 12:21:19 -03:00
committed by
Johannes Altmanninger
parent
66ea0f78be
commit
9dfb5705c5
@@ -202,7 +202,7 @@ fn source<'s>(&self, orig: &'s wstr) -> &'s wstr {
|
||||
/// The raw byte size of this node, excluding children.
|
||||
/// This also excludes the allocations stored in lists.
|
||||
fn self_memory_size(&self) -> usize {
|
||||
std::mem::size_of_val(self)
|
||||
size_of_val(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1166,7 +1166,7 @@ fn expand_home_directory(input: &mut WString, vars: &dyn Environment) {
|
||||
name_cstr.as_ptr(),
|
||||
userinfo.as_mut_ptr(),
|
||||
&mut buf[0],
|
||||
std::mem::size_of_val(&buf),
|
||||
size_of_val(&buf),
|
||||
&mut result,
|
||||
)
|
||||
};
|
||||
|
||||
@@ -88,13 +88,8 @@ pub fn try_consume(&self) -> bool {
|
||||
);
|
||||
let mut ret;
|
||||
loop {
|
||||
ret = unsafe {
|
||||
libc::read(
|
||||
self.read_fd(),
|
||||
buff.as_mut_ptr().cast(),
|
||||
std::mem::size_of_val(&buff),
|
||||
)
|
||||
};
|
||||
ret =
|
||||
unsafe { libc::read(self.read_fd(), buff.as_mut_ptr().cast(), size_of_val(&buff)) };
|
||||
if ret >= 0 || errno().0 != EINTR {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ fn get_interpreter<'a>(command: &CStr, buffer: &'a mut [u8]) -> Option<&'a CStr>
|
||||
if fd >= 0 {
|
||||
while idx + 1 < buffer.len() {
|
||||
let mut ch = b'\0';
|
||||
let amt = unsafe { libc::read(fd, (&raw mut ch).cast(), std::mem::size_of_val(&ch)) };
|
||||
let amt = unsafe { libc::read(fd, (&raw mut ch).cast(), size_of_val(&ch)) };
|
||||
if amt <= 0 || ch == b'\n' {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -420,8 +420,7 @@ pub fn read_once(fd: RawFd, buffer: &mut MutexGuard<'_, SeparatedBuffer>) -> isi
|
||||
|
||||
// We want to swallow EINTR only; in particular EAGAIN needs to be returned back to the caller.
|
||||
let amt = loop {
|
||||
let amt =
|
||||
unsafe { libc::read(fd, bytes.as_mut_ptr().cast(), std::mem::size_of_val(&bytes)) };
|
||||
let amt = unsafe { libc::read(fd, bytes.as_mut_ptr().cast(), size_of_val(&bytes)) };
|
||||
if amt < 0 && errno::errno().0 == EINTR {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user