]> git.lizzy.rs Git - rust.git/commitdiff
rm unnecessary libc allocator usage
authorDaniel Micay <danielmicay@gmail.com>
Fri, 24 Oct 2014 21:34:37 +0000 (17:34 -0400)
committerDaniel Micay <danielmicay@gmail.com>
Sat, 25 Oct 2014 16:33:27 +0000 (12:33 -0400)
src/librustrt/mutex.rs

index b328df1949e0e57ab9e2b608e3671109073b1e64..838dfd6b7abe6b5807dfc0e6e5df06b5ebae1743 100644 (file)
@@ -516,7 +516,7 @@ fn pthread_cond_wait(cond: *mut pthread_cond_t,
 
 #[cfg(windows)]
 mod imp {
-    use alloc::libc_heap::malloc_raw;
+    use alloc::heap;
     use core::atomic;
     use core::ptr;
     use libc::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES, c_void, DWORD, LPCSTR};
@@ -607,7 +607,7 @@ unsafe fn getcond(&self) -> *mut c_void {
     }
 
     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);
         return block as uint;
     }
@@ -619,7 +619,7 @@ pub unsafe fn init_cond() -> uint {
 
     pub unsafe fn free_lock(h: uint) {
         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) {