diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2014-05-09 22:59:46 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2014-05-10 19:58:18 -0400 |
| commit | 121ad1cb7db6517ed2aabc9c1514a99f5eb95149 (patch) | |
| tree | b777b0213aecc150a7a18a7cb14643657cc62afb /src/libstd | |
| parent | 87b658cf728b5d7e6b81012460454af634f6e6f8 (diff) | |
| download | rust-121ad1cb7db6517ed2aabc9c1514a99f5eb95149.tar.gz rust-121ad1cb7db6517ed2aabc9c1514a99f5eb95149.zip | |
rename `global_heap` -> `libc_heap`
This module only contains wrappers for malloc and realloc with out-of-memory checks.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/c_str.rs | 2 | ||||
| -rw-r--r-- | src/libstd/c_vec.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/libc_heap.rs (renamed from src/libstd/rt/global_heap.rs) | 0 | ||||
| -rw-r--r-- | src/libstd/rt/local_heap.rs | 7 | ||||
| -rw-r--r-- | src/libstd/rt/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/unstable/mutex.rs | 2 |
6 files changed, 9 insertions, 10 deletions
diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 7de74dbe507..b33d211aa19 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -81,7 +81,7 @@ use str::StrSlice; use str; use slice::{ImmutableVector, MutableVector}; use slice; -use rt::global_heap::malloc_raw; +use rt::libc_heap::malloc_raw; use raw::Slice; /// The representation of a C String. diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 4ef5af9275c..8c2c4fd1f0b 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -160,7 +160,7 @@ mod tests { use super::CVec; use libc; use ptr; - use rt::global_heap::malloc_raw; + use rt::libc_heap::malloc_raw; fn malloc(n: uint) -> CVec<u8> { unsafe { diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/libc_heap.rs index ece51ab9989..ece51ab9989 100644 --- a/src/libstd/rt/global_heap.rs +++ b/src/libstd/rt/libc_heap.rs diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs index 8795736b3f5..efc8072594b 100644 --- a/src/libstd/rt/local_heap.rs +++ b/src/libstd/rt/local_heap.rs @@ -18,7 +18,7 @@ use ops::Drop; use option::{Option, None, Some}; use ptr; use ptr::RawPtr; -use rt::global_heap; +use rt::libc_heap; use rt::local::Local; use rt::task::Task; use raw; @@ -188,7 +188,7 @@ impl MemoryRegion { fn malloc(&mut self, size: uint) -> *mut Box { let total_size = size + AllocHeader::size(); let alloc: *AllocHeader = unsafe { - global_heap::malloc_raw(total_size) as *AllocHeader + libc_heap::malloc_raw(total_size) as *AllocHeader }; let alloc: &mut AllocHeader = unsafe { cast::transmute(alloc) }; @@ -207,8 +207,7 @@ impl MemoryRegion { let total_size = size + AllocHeader::size(); let alloc: *AllocHeader = unsafe { - global_heap::realloc_raw(orig_alloc as *mut u8, - total_size) as *AllocHeader + libc_heap::realloc_raw(orig_alloc as *mut u8, total_size) as *AllocHeader }; let alloc: &mut AllocHeader = unsafe { cast::transmute(alloc) }; diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 904921cfa18..a04cbabedd6 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -26,7 +26,7 @@ language and an implementation must be provided regardless of the execution environment. Of foremost importance is the global exchange heap, in the module -`global_heap`. Very little practical Rust code can be written without +`heap`. Very little practical Rust code can be written without access to the global heap. Unlike most of `rt` the global heap is truly a global resource and generally operates independently of the rest of the runtime. @@ -86,8 +86,8 @@ pub mod shouldnt_be_public { // Internal macros used by the runtime. mod macros; -// The global (exchange) heap. -pub mod global_heap; +/// Wrappers around malloc / realloc aborting on out-of-memory. +pub mod libc_heap; /// The low-level memory allocation API. pub mod heap; diff --git a/src/libstd/unstable/mutex.rs b/src/libstd/unstable/mutex.rs index 8faedcbd9ed..c9d70915694 100644 --- a/src/libstd/unstable/mutex.rs +++ b/src/libstd/unstable/mutex.rs @@ -434,7 +434,7 @@ mod imp { #[cfg(windows)] mod imp { - use rt::global_heap::malloc_raw; + use rt::libc_heap::malloc_raw; use libc::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES, c_void, DWORD, LPCSTR}; use libc; use ptr; |
