Auto merge of #116463 - ChrisDenton:nlibc, r=workingjubilee
Remove libc We don't use much libc on Windows and it seemed silly to keep if for the sake of [two well documented constants](https://learn.microsoft.com/en-us/cpp/c-runtime-library/exit-success-exit-failure?view=msvc-170).
This commit is contained in:
commit
fd80c02c16
@ -46,6 +46,10 @@
|
||||
pub use LINGER as linger;
|
||||
pub use TIMEVAL as timeval;
|
||||
|
||||
// https://learn.microsoft.com/en-us/cpp/c-runtime-library/exit-success-exit-failure?view=msvc-170
|
||||
pub const EXIT_SUCCESS: u32 = 0;
|
||||
pub const EXIT_FAILURE: u32 = 1;
|
||||
|
||||
pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() };
|
||||
pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() };
|
||||
pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() };
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![cfg(not(test))]
|
||||
|
||||
use libc::{c_double, c_float, c_int};
|
||||
use core::ffi::{c_double, c_float, c_int};
|
||||
|
||||
extern "C" {
|
||||
pub fn acos(n: c_double) -> c_double;
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#[cfg(not(all(target_env = "msvc", target_arch = "x86")))]
|
||||
mod shims {
|
||||
use libc::c_float;
|
||||
use core::ffi::c_float;
|
||||
|
||||
extern "C" {
|
||||
pub fn acosf(n: c_float) -> c_float;
|
||||
@ -52,7 +52,7 @@ mod shims {
|
||||
// back to f32. While not precisely correct should be "correct enough" for now.
|
||||
#[cfg(all(target_env = "msvc", target_arch = "x86"))]
|
||||
mod shims {
|
||||
use libc::c_float;
|
||||
use core::ffi::c_float;
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn acosf(n: c_float) -> c_float {
|
||||
|
@ -16,6 +16,8 @@
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::thread;
|
||||
|
||||
use core::ffi::c_void;
|
||||
|
||||
use super::path::maybe_verbatim;
|
||||
use super::to_u16s;
|
||||
|
||||
@ -371,7 +373,7 @@ pub fn file_attr(&self) -> io::Result<FileAttr> {
|
||||
cvt(c::GetFileInformationByHandleEx(
|
||||
self.handle.as_raw_handle(),
|
||||
c::FileBasicInfo,
|
||||
&mut info as *mut _ as *mut libc::c_void,
|
||||
&mut info as *mut _ as *mut c_void,
|
||||
size as c::DWORD,
|
||||
))?;
|
||||
let mut attr = FileAttr {
|
||||
@ -399,7 +401,7 @@ pub fn file_attr(&self) -> io::Result<FileAttr> {
|
||||
cvt(c::GetFileInformationByHandleEx(
|
||||
self.handle.as_raw_handle(),
|
||||
c::FileStandardInfo,
|
||||
&mut info as *mut _ as *mut libc::c_void,
|
||||
&mut info as *mut _ as *mut c_void,
|
||||
size as c::DWORD,
|
||||
))?;
|
||||
attr.file_size = info.AllocationSize as u64;
|
||||
@ -624,7 +626,7 @@ fn basic_info(&self) -> io::Result<c::FILE_BASIC_INFO> {
|
||||
cvt(c::GetFileInformationByHandleEx(
|
||||
self.handle.as_raw_handle(),
|
||||
c::FileBasicInfo,
|
||||
&mut info as *mut _ as *mut libc::c_void,
|
||||
&mut info as *mut _ as *mut c_void,
|
||||
size as c::DWORD,
|
||||
))?;
|
||||
Ok(info)
|
||||
|
@ -3,7 +3,7 @@
|
||||
use crate::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle};
|
||||
use crate::slice;
|
||||
use crate::sys::c;
|
||||
use libc;
|
||||
use core::ffi::c_void;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(transparent)]
|
||||
@ -136,7 +136,7 @@ struct FILE_NAME_INFO {
|
||||
let res = c::GetFileInformationByHandleEx(
|
||||
handle,
|
||||
c::FileNameInfo,
|
||||
&mut name_info as *mut _ as *mut libc::c_void,
|
||||
&mut name_info as *mut _ as *mut c_void,
|
||||
size_of::<FILE_NAME_INFO>() as u32,
|
||||
);
|
||||
if res == 0 {
|
||||
|
@ -15,7 +15,7 @@
|
||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||
use crate::time::Duration;
|
||||
|
||||
use libc::{c_int, c_long, c_ulong, c_ushort};
|
||||
use core::ffi::{c_int, c_long, c_ulong, c_ushort};
|
||||
|
||||
pub type wrlen_t = i32;
|
||||
|
||||
|
@ -19,8 +19,7 @@
|
||||
use crate::ptr;
|
||||
use crate::sync::Mutex;
|
||||
use crate::sys::args::{self, Arg};
|
||||
use crate::sys::c;
|
||||
use crate::sys::c::NonZeroDWORD;
|
||||
use crate::sys::c::{self, NonZeroDWORD, EXIT_FAILURE, EXIT_SUCCESS};
|
||||
use crate::sys::cvt;
|
||||
use crate::sys::fs::{File, OpenOptions};
|
||||
use crate::sys::handle::Handle;
|
||||
@ -30,7 +29,7 @@
|
||||
use crate::sys_common::process::{CommandEnv, CommandEnvs};
|
||||
use crate::sys_common::IntoInner;
|
||||
|
||||
use libc::{c_void, EXIT_FAILURE, EXIT_SUCCESS};
|
||||
use core::ffi::c_void;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Command
|
||||
|
@ -10,7 +10,7 @@
|
||||
use crate::sys_common::FromInner;
|
||||
use crate::time::Duration;
|
||||
|
||||
use libc::c_void;
|
||||
use core::ffi::c_void;
|
||||
|
||||
use super::to_u16s;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user