Skip to content

Commit 5a9fb1f

Browse files
committed
Import core::ffi::c_void in more places
1 parent 6242470 commit 5a9fb1f

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

std/src/sys/pal/windows/alloc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetProcessHeap() -> c::HANDLE)
3737
// Note that `dwBytes` is allowed to be zero, contrary to some other allocators.
3838
//
3939
// See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapalloc
40-
windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dwflags: u32, dwbytes: usize) -> *mut core::ffi::c_void);
40+
windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dwflags: u32, dwbytes: usize) -> *mut c_void);
4141

4242
// Reallocate a block of memory behind a given pointer `lpMem` from a given heap `hHeap`,
4343
// to a block of at least `dwBytes` bytes, either shrinking the block in place,
@@ -61,9 +61,9 @@ windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dw
6161
windows_targets::link!("kernel32.dll" "system" fn HeapReAlloc(
6262
hheap: c::HANDLE,
6363
dwflags : u32,
64-
lpmem: *const core::ffi::c_void,
64+
lpmem: *const c_void,
6565
dwbytes: usize
66-
) -> *mut core::ffi::c_void);
66+
) -> *mut c_void);
6767

6868
// Free a block of memory behind a given pointer `lpMem` from a given heap `hHeap`.
6969
// Returns a nonzero value if the operation is successful, and zero if the operation fails.
@@ -79,7 +79,7 @@ windows_targets::link!("kernel32.dll" "system" fn HeapReAlloc(
7979
// Note that `lpMem` is allowed to be null, which will not cause the operation to fail.
8080
//
8181
// See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapfree
82-
windows_targets::link!("kernel32.dll" "system" fn HeapFree(hheap: c::HANDLE, dwflags: u32, lpmem: *const core::ffi::c_void) -> c::BOOL);
82+
windows_targets::link!("kernel32.dll" "system" fn HeapFree(hheap: c::HANDLE, dwflags: u32, lpmem: *const c_void) -> c::BOOL);
8383

8484
// Cached handle to the default heap of the current process.
8585
// Either a non-null handle returned by `GetProcessHeap`, or null when not yet initialized or `GetProcessHeap` failed.

std/src/sys/pal/windows/c.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
#![cfg_attr(test, allow(dead_code))]
55
#![unstable(issue = "none", feature = "windows_c")]
66
#![allow(clippy::style)]
7-
#![allow(unsafe_op_in_unsafe_fn)]
87

9-
use crate::ffi::CStr;
10-
use crate::mem;
11-
use crate::os::raw::{c_uint, c_ulong, c_ushort, c_void};
12-
use crate::ptr;
8+
use core::ffi::{c_uint, c_ulong, c_ushort, c_void, CStr};
9+
use core::mem;
10+
use core::ptr;
1311

1412
pub(super) mod windows_targets;
1513

@@ -188,12 +186,12 @@ extern "system" {
188186
compat_fn_optional! {
189187
crate::sys::compat::load_synch_functions();
190188
pub fn WaitOnAddress(
191-
address: *const ::core::ffi::c_void,
192-
compareaddress: *const ::core::ffi::c_void,
189+
address: *const c_void,
190+
compareaddress: *const c_void,
193191
addresssize: usize,
194192
dwmilliseconds: u32
195193
) -> BOOL;
196-
pub fn WakeByAddressSingle(address: *const ::core::ffi::c_void);
194+
pub fn WakeByAddressSingle(address: *const c_void);
197195
}
198196

199197
#[cfg(any(target_vendor = "win7", target_vendor = "uwp"))]
@@ -240,7 +238,7 @@ compat_fn_with_fallback! {
240238
shareaccess: FILE_SHARE_MODE,
241239
createdisposition: NTCREATEFILE_CREATE_DISPOSITION,
242240
createoptions: NTCREATEFILE_CREATE_OPTIONS,
243-
eabuffer: *const ::core::ffi::c_void,
241+
eabuffer: *const c_void,
244242
ealength: u32
245243
) -> NTSTATUS {
246244
STATUS_NOT_IMPLEMENTED
@@ -250,9 +248,9 @@ compat_fn_with_fallback! {
250248
filehandle: HANDLE,
251249
event: HANDLE,
252250
apcroutine: PIO_APC_ROUTINE,
253-
apccontext: *const core::ffi::c_void,
251+
apccontext: *const c_void,
254252
iostatusblock: *mut IO_STATUS_BLOCK,
255-
buffer: *mut core::ffi::c_void,
253+
buffer: *mut c_void,
256254
length: u32,
257255
byteoffset: *const i64,
258256
key: *const u32
@@ -264,9 +262,9 @@ compat_fn_with_fallback! {
264262
filehandle: HANDLE,
265263
event: HANDLE,
266264
apcroutine: PIO_APC_ROUTINE,
267-
apccontext: *const core::ffi::c_void,
265+
apccontext: *const c_void,
268266
iostatusblock: *mut IO_STATUS_BLOCK,
269-
buffer: *const core::ffi::c_void,
267+
buffer: *const c_void,
270268
length: u32,
271269
byteoffset: *const i64,
272270
key: *const u32

std/src/sys/pal/windows/handle.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
#[cfg(test)]
44
mod tests;
55

6-
use crate::cmp;
76
use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, Read};
8-
use crate::mem;
97
use crate::os::windows::io::{
108
AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle,
119
};
12-
use crate::ptr;
1310
use crate::sys::c;
1411
use crate::sys::cvt;
1512
use crate::sys_common::{AsInner, FromInner, IntoInner};
13+
use core::cmp;
14+
use core::ffi::c_void;
15+
use core::mem;
16+
use core::ptr;
1617

1718
/// An owned container for `HANDLE` object, closing them on Drop.
1819
///
@@ -255,7 +256,7 @@ impl Handle {
255256
None,
256257
ptr::null_mut(),
257258
&mut io_status,
258-
buf.cast::<core::ffi::c_void>(),
259+
buf.cast::<c_void>(),
259260
len,
260261
offset.as_ref().map(|n| ptr::from_ref(n).cast::<i64>()).unwrap_or(ptr::null()),
261262
ptr::null(),
@@ -305,7 +306,7 @@ impl Handle {
305306
None,
306307
ptr::null_mut(),
307308
&mut io_status,
308-
buf.as_ptr().cast::<core::ffi::c_void>(),
309+
buf.as_ptr().cast::<c_void>(),
309310
len,
310311
offset.as_ref().map(|n| ptr::from_ref(n).cast::<i64>()).unwrap_or(ptr::null()),
311312
ptr::null(),

0 commit comments

Comments
 (0)