about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-10-24 17:34:57 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-10-25 14:12:19 -0400
commit2bc4d3ec23cc88155173729e60df54c8aa4949a6 (patch)
tree46b2d71ffeba2ffa639b8f67c9480617d04aea9f /src/libstd
parent6f253bd49e80c809b7c22fd257bcef06a8ca7c30 (diff)
downloadrust-2bc4d3ec23cc88155173729e60df54c8aa4949a6.tar.gz
rust-2bc4d3ec23cc88155173729e60df54c8aa4949a6.zip
get rid of libc_heap::{malloc_raw, realloc_raw}
The C standard library functions should be used directly. The quirky
NULL / zero-size allocation workaround is no longer necessary and was
adding an extra branch to the allocator code path in a build without
jemalloc. This is a small step towards liballoc being compatible with
handling OOM errors instead of aborting (#18292).

[breaking-change]
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/c_vec.rs4
-rw-r--r--src/libstd/rt/mod.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs
index 95f8ab72016..7ec25acb173 100644
--- a/src/libstd/c_vec.rs
+++ b/src/libstd/c_vec.rs
@@ -165,11 +165,11 @@ mod tests {
     use super::CVec;
     use libc;
     use ptr;
-    use rt::libc_heap::malloc_raw;
 
     fn malloc(n: uint) -> CVec<u8> {
         unsafe {
-            let mem = malloc_raw(n);
+            let mem = libc::malloc(n as libc::size_t);
+            if mem.is_null() { fail!("out of memory") }
 
             CVec::new_with_dtor(mem as *mut u8, n,
                 proc() { libc::free(mem as *mut libc::c_void); })
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 689bcdad131..a91c6c572e6 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -62,7 +62,7 @@ pub use self::util::{default_sched_threads, min_stack, running_on_valgrind};
 
 // Reexport functionality from librustrt and other crates underneath the
 // standard library which work together to create the entire runtime.
-pub use alloc::{heap, libc_heap};
+pub use alloc::heap;
 pub use rustrt::{task, local, mutex, exclusive, stack, args, rtio, thread};
 pub use rustrt::{Stdio, Stdout, Stderr, begin_unwind, begin_unwind_fmt};
 pub use rustrt::{bookkeeping, at_exit, unwind, DEFAULT_ERROR_CODE, Runtime};