Fix warning in alloc_system.rs

This commit is contained in:
bjorn3 2024-04-22 17:10:30 +00:00
parent 569df1dad3
commit 498dbbd018

View File

@ -80,7 +80,6 @@ mod platform {
extern "system" { extern "system" {
fn GetProcessHeap() -> HANDLE; fn GetProcessHeap() -> HANDLE;
fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID;
fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID, dwBytes: SIZE_T) -> LPVOID;
fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL; fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
fn GetLastError() -> DWORD; fn GetLastError() -> DWORD;
} }
@ -111,7 +110,7 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
allocate_with_flags(layout, HEAP_ZERO_MEMORY) allocate_with_flags(layout, HEAP_ZERO_MEMORY)
} }
#[inline] #[inline]
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
let header = get_header(ptr); let header = get_header(ptr);
let err = HeapFree(GetProcessHeap(), 0, header.0 as LPVOID); let err = HeapFree(GetProcessHeap(), 0, header.0 as LPVOID);
debug_assert!(err != 0, "Failed to free heap memory: {}", GetLastError()); debug_assert!(err != 0, "Failed to free heap memory: {}", GetLastError());