rm unnecessary libc allocator usage
This commit is contained in:
parent
6c18e508f1
commit
6f253bd49e
1 changed files with 3 additions and 3 deletions
|
@ -516,7 +516,7 @@ mod imp {
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
mod imp {
|
mod imp {
|
||||||
use alloc::libc_heap::malloc_raw;
|
use alloc::heap;
|
||||||
use core::atomic;
|
use core::atomic;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use libc::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES, c_void, DWORD, LPCSTR};
|
use libc::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES, c_void, DWORD, LPCSTR};
|
||||||
|
@ -607,7 +607,7 @@ mod imp {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn init_lock() -> uint {
|
pub unsafe fn init_lock() -> uint {
|
||||||
let block = malloc_raw(CRIT_SECTION_SIZE as uint) as *mut c_void;
|
let block = heap::allocate(CRIT_SECTION_SIZE, 8) as *mut c_void;
|
||||||
InitializeCriticalSectionAndSpinCount(block, SPIN_COUNT);
|
InitializeCriticalSectionAndSpinCount(block, SPIN_COUNT);
|
||||||
return block as uint;
|
return block as uint;
|
||||||
}
|
}
|
||||||
|
@ -619,7 +619,7 @@ mod imp {
|
||||||
|
|
||||||
pub unsafe fn free_lock(h: uint) {
|
pub unsafe fn free_lock(h: uint) {
|
||||||
DeleteCriticalSection(h as LPCRITICAL_SECTION);
|
DeleteCriticalSection(h as LPCRITICAL_SECTION);
|
||||||
libc::free(h as *mut c_void);
|
heap::deallocate(h as *mut u8, CRIT_SECTION_SIZE, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn free_cond(h: uint) {
|
pub unsafe fn free_cond(h: uint) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue