Rollup merge of #105524 - Ayush1325:libc-free, r=ChrisDenton
Replace libc::{type} with crate::ffi::{type} Replace libc::{type} imports with crate::ffi::{type} outside of `std::sys` and `std::os`. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
This commit is contained in:
commit
45430a5351
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
use crate::ffi::{c_char, c_int};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use crate::os::unix::fs::symlink as symlink_dir;
|
use crate::os::unix::fs::symlink as symlink_dir;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
@ -24,8 +26,6 @@
|
|||||||
use crate::sys::fs::symlink_junction;
|
use crate::sys::fs::symlink_junction;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use crate::sys::weak::weak;
|
use crate::sys::weak::weak;
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
use libc::{c_char, c_int};
|
|
||||||
|
|
||||||
macro_rules! check {
|
macro_rules! check {
|
||||||
($e:expr) => {
|
($e:expr) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! On Emscripten Rust panics are wrapped in C++ exceptions, so we just forward
|
//! On Emscripten Rust panics are wrapped in C++ exceptions, so we just forward
|
||||||
//! to `__gxx_personality_v0` which is provided by Emscripten.
|
//! to `__gxx_personality_v0` which is provided by Emscripten.
|
||||||
|
|
||||||
use libc::c_int;
|
use crate::ffi::c_int;
|
||||||
use unwind as uw;
|
use unwind as uw;
|
||||||
|
|
||||||
// This is required by the compiler to exist (e.g., it's a lang item), but it's
|
// This is required by the compiler to exist (e.g., it's a lang item), but it's
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
//! and the last personality routine transfers control to the catch block.
|
//! and the last personality routine transfers control to the catch block.
|
||||||
|
|
||||||
use super::dwarf::eh::{self, EHAction, EHContext};
|
use super::dwarf::eh::{self, EHAction, EHContext};
|
||||||
use libc::{c_int, uintptr_t};
|
use crate::ffi::c_int;
|
||||||
|
use libc::uintptr_t;
|
||||||
use unwind as uw;
|
use unwind as uw;
|
||||||
|
|
||||||
// Register ids were lifted from LLVM's TargetLowering::getExceptionPointerRegister()
|
// Register ids were lifted from LLVM's TargetLowering::getExceptionPointerRegister()
|
||||||
|
@ -221,7 +221,7 @@ fn ptr(&self) -> c::LPVOID {
|
|||||||
|
|
||||||
fn keyed_event_handle() -> c::HANDLE {
|
fn keyed_event_handle() -> c::HANDLE {
|
||||||
const INVALID: c::HANDLE = ptr::invalid_mut(!0);
|
const INVALID: c::HANDLE = ptr::invalid_mut(!0);
|
||||||
static HANDLE: AtomicPtr<libc::c_void> = AtomicPtr::new(INVALID);
|
static HANDLE: AtomicPtr<crate::ffi::c_void> = AtomicPtr::new(INVALID);
|
||||||
match HANDLE.load(Relaxed) {
|
match HANDLE.load(Relaxed) {
|
||||||
INVALID => {
|
INVALID => {
|
||||||
let mut handle = c::INVALID_HANDLE_VALUE;
|
let mut handle = c::INVALID_HANDLE_VALUE;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
use crate::sys_common::{AsInner, FromInner, IntoInner};
|
||||||
use crate::time::Duration;
|
use crate::time::Duration;
|
||||||
|
|
||||||
use libc::{c_int, c_void};
|
use crate::ffi::{c_int, c_void};
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(
|
if #[cfg(any(
|
||||||
@ -47,7 +47,7 @@
|
|||||||
target_os = "dragonfly", target_os = "freebsd",
|
target_os = "dragonfly", target_os = "freebsd",
|
||||||
target_os = "openbsd", target_os = "netbsd",
|
target_os = "openbsd", target_os = "netbsd",
|
||||||
target_os = "solaris", target_os = "illumos"))] {
|
target_os = "solaris", target_os = "illumos"))] {
|
||||||
use libc::c_uchar;
|
use crate::ffi::c_uchar;
|
||||||
type IpV4MultiCastType = c_uchar;
|
type IpV4MultiCastType = c_uchar;
|
||||||
} else {
|
} else {
|
||||||
type IpV4MultiCastType = c_int;
|
type IpV4MultiCastType = c_int;
|
||||||
@ -127,8 +127,8 @@ fn to_ipv6mr_interface(value: u32) -> c_int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
fn to_ipv6mr_interface(value: u32) -> libc::c_uint {
|
fn to_ipv6mr_interface(value: u32) -> crate::ffi::c_uint {
|
||||||
value as libc::c_uint
|
value as crate::ffi::c_uint
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user