diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-06-17 10:27:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-17 08:27:50 +0000 |
commit | e902d63732e96f71c86bae159786e12b18876b3c (patch) | |
tree | b7de256cb560fc9f823fdcccbfcaba2b2cd54ca3 /components/allocator | |
parent | 8b35c4094a44e3d47ebfa5c7ff11b15ec6b22b05 (diff) | |
download | servo-e902d63732e96f71c86bae159786e12b18876b3c.tar.gz servo-e902d63732e96f71c86bae159786e12b18876b3c.zip |
deps: Switch from `winapi` to `windows_sys` in Servo code (#32516)
This is part of the switch from `winapi` to `windows-sys`. `windows-sys` is
maintained by Microsoft, so is more "official." More and more crates are
switching to it.
Diffstat (limited to 'components/allocator')
-rw-r--r-- | components/allocator/Cargo.toml | 2 | ||||
-rw-r--r-- | components/allocator/lib.rs | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/components/allocator/Cargo.toml b/components/allocator/Cargo.toml index 75c2bc15d29..e5a5bc67457 100644 --- a/components/allocator/Cargo.toml +++ b/components/allocator/Cargo.toml @@ -18,7 +18,7 @@ jemalloc-sys = { workspace = true } libc = { workspace = true, optional = true } [target.'cfg(windows)'.dependencies] -winapi = { workspace = true, features = ["heapapi"] } +windows-sys = { workspace = true, features = ["Win32_System_Memory"] } [target.'cfg(target_env = "ohos")'.dependencies] libc = { workspace = true } diff --git a/components/allocator/lib.rs b/components/allocator/lib.rs index c572f9e552e..aa7f6b1e99a 100644 --- a/components/allocator/lib.rs +++ b/components/allocator/lib.rs @@ -61,7 +61,8 @@ mod platform { pub use std::alloc::System as Allocator; use std::os::raw::c_void; - use winapi::um::heapapi::{GetProcessHeap, HeapSize, HeapValidate}; + use windows_sys::Win32::Foundation::FALSE; + use windows_sys::Win32::System::Memory::{GetProcessHeap, HeapSize, HeapValidate}; /// Get the size of a heap block. /// @@ -71,8 +72,8 @@ mod platform { pub unsafe extern "C" fn usable_size(mut ptr: *const c_void) -> usize { let heap = GetProcessHeap(); - if HeapValidate(heap, 0, ptr) == 0 { - ptr = *(ptr as *const *const c_void).offset(-1); + if HeapValidate(heap, 0, ptr) == FALSE { + ptr = *(ptr as *const *const c_void).offset(-1) } HeapSize(heap, 0, ptr) as usize |