Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d3205de

Browse filesBrowse files
committed
Remove LPVOID
1 parent 68ac381 commit d3205de
Copy full SHA for d3205de

File tree

Expand file treeCollapse file tree

6 files changed

+18
-18
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+18
-18
lines changed

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

Copy file name to clipboardExpand all lines: std/src/sys/pal/windows/alloc.rs
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ extern "C" fn process_heap_init_and_alloc(
115115
_heap: MaybeUninit<c::HANDLE>, // We pass this argument to match the ABI of `HeapAlloc`
116116
flags: c::DWORD,
117117
dwBytes: usize,
118-
) -> c::LPVOID {
118+
) -> *mut c_void {
119119
let heap = init_or_get_process_heap();
120120
if core::intrinsics::unlikely(heap.is_null()) {
121121
return ptr::null_mut();
@@ -129,7 +129,7 @@ fn process_heap_alloc(
129129
_heap: MaybeUninit<c::HANDLE>, // We pass this argument to match the ABI of `HeapAlloc`,
130130
flags: c::DWORD,
131131
dwBytes: usize,
132-
) -> c::LPVOID {
132+
) -> *mut c_void {
133133
let heap = HEAP.load(Ordering::Relaxed);
134134
if core::intrinsics::likely(!heap.is_null()) {
135135
// SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`.
@@ -240,7 +240,7 @@ unsafe impl GlobalAlloc for System {
240240

241241
// SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`,
242242
// `block` is a pointer to the start of an allocated block.
243-
unsafe { HeapFree(heap, 0, block as c::LPVOID) };
243+
unsafe { HeapFree(heap, 0, block.cast::<c_void>()) };
244244
}
245245

246246
#[inline]
@@ -253,7 +253,7 @@ unsafe impl GlobalAlloc for System {
253253
// SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`,
254254
// `ptr` is a pointer to the start of an allocated block.
255255
// The returned pointer points to the start of an allocated block.
256-
unsafe { HeapReAlloc(heap, 0, ptr as c::LPVOID, new_size) as *mut u8 }
256+
unsafe { HeapReAlloc(heap, 0, ptr.cast::<c_void>(), new_size).cast::<u8>() }
257257
} else {
258258
// SAFETY: `realloc_fallback` is implemented using `dealloc` and `alloc`, which will
259259
// correctly handle `ptr` and return a pointer satisfying the guarantees of `System`

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

Copy file name to clipboardExpand all lines: std/src/sys/pal/windows/c.rs
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ pub type DWORD = c_ulong;
2121
pub type WCHAR = u16;
2222
pub type ULONG = c_ulong;
2323

24-
pub type LPVOID = *mut c_void;
25-
2624
#[cfg(target_vendor = "win7")]
2725
pub type PSRWLOCK = *mut SRWLOCK;
2826

@@ -390,15 +388,15 @@ compat_fn_with_fallback! {
390388
pub fn NtCreateKeyedEvent(
391389
KeyedEventHandle: *mut HANDLE,
392390
DesiredAccess: DWORD,
393-
ObjectAttributes: LPVOID,
391+
ObjectAttributes: *mut c_void,
394392
Flags: ULONG
395393
) -> NTSTATUS {
396394
panic!("keyed events not available")
397395
}
398396
#[cfg(target_vendor = "win7")]
399397
pub fn NtReleaseKeyedEvent(
400398
EventHandle: HANDLE,
401-
Key: LPVOID,
399+
Key: *mut c_void,
402400
Alertable: BOOLEAN,
403401
Timeout: *mut c_longlong
404402
) -> NTSTATUS {
@@ -407,7 +405,7 @@ compat_fn_with_fallback! {
407405
#[cfg(target_vendor = "win7")]
408406
pub fn NtWaitForKeyedEvent(
409407
EventHandle: HANDLE,
410-
Key: LPVOID,
408+
Key: *mut c_void,
411409
Alertable: BOOLEAN,
412410
Timeout: *mut c_longlong
413411
) -> NTSTATUS {

‎std/src/sys/pal/windows/pipe.rs

Copy file name to clipboardExpand all lines: std/src/sys/pal/windows/pipe.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn random_number() -> usize {
225225
// Abstracts over `ReadFileEx` and `WriteFileEx`
226226
type AlertableIoFn = unsafe extern "system" fn(
227227
BorrowedHandle<'_>,
228-
c::LPVOID,
228+
*mut core::ffi::c_void,
229229
c::DWORD,
230230
*mut c::OVERLAPPED,
231231
c::LPOVERLAPPED_COMPLETION_ROUTINE,
@@ -327,7 +327,7 @@ impl AnonPipe {
327327
unsafe fn alertable_io_internal(
328328
&self,
329329
io: AlertableIoFn,
330-
buf: c::LPVOID,
330+
buf: *mut core::ffi::c_void,
331331
len: c::DWORD,
332332
) -> io::Result<usize> {
333333
// Use "alertable I/O" to synchronize the pipe I/O.

‎std/src/sys/pal/windows/stdio.rs

Copy file name to clipboardExpand all lines: std/src/sys/pal/windows/stdio.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit<u16>]) -> io::Result<usiz
355355
c::SetLastError(0);
356356
c::ReadConsoleW(
357357
handle,
358-
buf.as_mut_ptr() as c::LPVOID,
358+
buf.as_mut_ptr() as *mut core::ffi::c_void,
359359
buf.len() as u32,
360360
&mut amount,
361361
&input_control,

‎std/src/sys/sync/thread_parking/windows.rs

Copy file name to clipboardExpand all lines: std/src/sys/sync/thread_parking/windows.rs
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use crate::sync::atomic::{
6464
};
6565
use crate::sys::{c, dur2timeout};
6666
use crate::time::Duration;
67+
use core::ffi::c_void;
6768

6869
pub struct Parker {
6970
state: AtomicI8,
@@ -117,7 +118,7 @@ impl Parker {
117118

118119
loop {
119120
// Wait for something to happen, assuming it's still set to PARKED.
120-
c::WaitOnAddress(self.ptr(), &PARKED as *const _ as c::LPVOID, 1, c::INFINITE);
121+
c::WaitOnAddress(self.ptr(), &PARKED as *const _ as *const c_void, 1, c::INFINITE);
121122
// Change NOTIFIED=>EMPTY but leave PARKED alone.
122123
if self.state.compare_exchange(NOTIFIED, EMPTY, Acquire, Acquire).is_ok() {
123124
// Actually woken up by unpark().
@@ -144,7 +145,7 @@ impl Parker {
144145
}
145146

146147
// Wait for something to happen, assuming it's still set to PARKED.
147-
c::WaitOnAddress(self.ptr(), &PARKED as *const _ as c::LPVOID, 1, dur2timeout(timeout));
148+
c::WaitOnAddress(self.ptr(), &PARKED as *const _ as *const c_void, 1, dur2timeout(timeout));
148149
// Set the state back to EMPTY (from either PARKED or NOTIFIED).
149150
// Note that we don't just write EMPTY, but use swap() to also
150151
// include an acquire-ordered read to synchronize with unpark()'s
@@ -177,8 +178,8 @@ impl Parker {
177178
}
178179
}
179180

180-
fn ptr(&self) -> c::LPVOID {
181-
core::ptr::addr_of!(self.state) as c::LPVOID
181+
fn ptr(&self) -> *const c_void {
182+
core::ptr::addr_of!(self.state).cast::<c_void>()
182183
}
183184
}
184185

‎std/src/sys/thread_local/guard/windows.rs

Copy file name to clipboardExpand all lines: std/src/sys/thread_local/guard/windows.rs
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
6666
use crate::ptr;
6767
use crate::sys::c;
68+
use core::ffi::c_void;
6869

6970
pub fn enable() {
7071
// When destructors are used, we don't want LLVM eliminating CALLBACK for any
@@ -74,9 +75,9 @@ pub fn enable() {
7475

7576
#[link_section = ".CRT$XLB"]
7677
#[cfg_attr(miri, used)] // Miri only considers explicitly `#[used]` statics for `lookup_link_section`
77-
pub static CALLBACK: unsafe extern "system" fn(c::LPVOID, c::DWORD, c::LPVOID) = tls_callback;
78+
pub static CALLBACK: unsafe extern "system" fn(*mut c_void, c::DWORD, *mut c_void) = tls_callback;
7879

79-
unsafe extern "system" fn tls_callback(_h: c::LPVOID, dw_reason: c::DWORD, _pv: c::LPVOID) {
80+
unsafe extern "system" fn tls_callback(_h: *mut c_void, dw_reason: c::DWORD, _pv: *mut c_void) {
8081
// See comments above for what this is doing. Note that we don't need this
8182
// trickery on GNU windows, just on MSVC.
8283
#[cfg(all(target_env = "msvc", not(target_thread_local)))]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.