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 | |
| 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.
| -rw-r--r-- | src/libcollections/hashmap.rs | 4 | ||||
| -rw-r--r-- | src/libnative/io/file_win32.rs | 2 | ||||
| -rw-r--r-- | src/librustuv/uvll.rs | 2 | ||||
| -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 |
9 files changed, 13 insertions, 14 deletions
diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs index 2d1de87fe06..1a222a27e47 100644 --- a/src/libcollections/hashmap.rs +++ b/src/libcollections/hashmap.rs @@ -42,7 +42,7 @@ mod table { use std::prelude::Drop; use std::ptr; use std::ptr::RawPtr; - use std::rt::global_heap; + use std::rt::libc_heap; use std::intrinsics::{size_of, min_align_of, transmute}; use std::intrinsics::{move_val_init, set_memory}; use std::iter::{Iterator, range_step_inclusive}; @@ -243,7 +243,7 @@ mod table { keys_size, min_align_of::< K >(), vals_size, min_align_of::< V >()); - let buffer = global_heap::malloc_raw(size) as *mut u8; + let buffer = libc_heap::malloc_raw(size) as *mut u8; // FIXME #13094: If malloc was not at as aligned as we expected, // our offset calculations are just plain wrong. We could support diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs index 42e5ad062ee..5fc9e506cf2 100644 --- a/src/libnative/io/file_win32.rs +++ b/src/libnative/io/file_win32.rs @@ -339,7 +339,7 @@ pub fn mkdir(p: &CString, _mode: io::FilePermission) -> IoResult<()> { } pub fn readdir(p: &CString) -> IoResult<Vec<Path>> { - use std::rt::global_heap::malloc_raw; + use std::rt::libc_heap::malloc_raw; fn prune(root: &CString, dirs: Vec<Path>) -> Vec<Path> { let root = unsafe { CString::new(root.with_ref(|p| p), false) }; diff --git a/src/librustuv/uvll.rs b/src/librustuv/uvll.rs index 57f4bd9d7eb..6236fd0e0e5 100644 --- a/src/librustuv/uvll.rs +++ b/src/librustuv/uvll.rs @@ -32,7 +32,7 @@ use libc::{size_t, c_int, c_uint, c_void, c_char, c_double}; use libc::{ssize_t, sockaddr, free, addrinfo}; use libc; -use std::rt::global_heap::malloc_raw; +use std::rt::libc_heap::malloc_raw; #[cfg(test)] use libc::uintptr_t; 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; |
