Skip to content

Commit 6f253bd

Browse files
committed
rm unnecessary libc allocator usage
1 parent 6c18e50 commit 6f253bd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustrt/mutex.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ mod imp {
516516

517517
#[cfg(windows)]
518518
mod imp {
519-
use alloc::libc_heap::malloc_raw;
519+
use alloc::heap;
520520
use core::atomic;
521521
use core::ptr;
522522
use libc::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES, c_void, DWORD, LPCSTR};
@@ -607,7 +607,7 @@ mod imp {
607607
}
608608

609609
pub unsafe fn init_lock() -> uint {
610-
let block = malloc_raw(CRIT_SECTION_SIZE as uint) as *mut c_void;
610+
let block = heap::allocate(CRIT_SECTION_SIZE, 8) as *mut c_void;
611611
InitializeCriticalSectionAndSpinCount(block, SPIN_COUNT);
612612
return block as uint;
613613
}
@@ -619,7 +619,7 @@ mod imp {
619619

620620
pub unsafe fn free_lock(h: uint) {
621621
DeleteCriticalSection(h as LPCRITICAL_SECTION);
622-
libc::free(h as *mut c_void);
622+
heap::deallocate(h as *mut u8, CRIT_SECTION_SIZE, 8);
623623
}
624624

625625
pub unsafe fn free_cond(h: uint) {

0 commit comments

Comments
 (0)