summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-12-18 01:49:31 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2013-12-19 09:26:13 +1100
commit4c79b22ef26a2b846d84c46bc8fea50c953559dd (patch)
tree195c5edab1e773dcd7db4454b6d848a47d5a6249 /src/libstd/io
parentac137f6dbe51429de203ea2e900b8bac01f466cb (diff)
downloadrust-4c79b22ef26a2b846d84c46bc8fea50c953559dd.tar.gz
rust-4c79b22ef26a2b846d84c46bc8fea50c953559dd.zip
std::vec: remove .as_imm_buf, replaced by .as_ptr & .len.
There's no need for the restrictions of a closure with the above methods.
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/native/file.rs4
-rw-r--r--src/libstd/io/native/process.rs9
2 files changed, 7 insertions, 6 deletions
diff --git a/src/libstd/io/native/file.rs b/src/libstd/io/native/file.rs
index bd618dd6f0f..74d18f11a1d 100644
--- a/src/libstd/io/native/file.rs
+++ b/src/libstd/io/native/file.rs
@@ -37,8 +37,8 @@ fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
     #[cfg(windows)] static eintr: int = 0; // doesn't matter
     #[cfg(not(windows))] static eintr: int = libc::EINTR as int;
 
-    let (data, origamt) = data.as_imm_buf(|data, amt| (data, amt));
-    let mut data = data;
+    let origamt = data.len();
+    let mut data = data.as_ptr();
     let mut amt = origamt;
     while amt > 0 {
         let mut ret;
diff --git a/src/libstd/io/native/process.rs b/src/libstd/io/native/process.rs
index a1f50b15f23..ef972dc4d0a 100644
--- a/src/libstd/io/native/process.rs
+++ b/src/libstd/io/native/process.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use cast;
 use io;
 use libc::{pid_t, c_void, c_int};
 use libc;
@@ -17,6 +16,8 @@ use prelude::*;
 use ptr;
 use rt::rtio;
 use super::file;
+#[cfg(windows)]
+use cast;
 
 use p = io::process;
 
@@ -453,7 +454,7 @@ fn with_argv<T>(prog: &str, args: &[~str], cb: |**libc::c_char| -> T) -> T {
     // Finally, make sure we add a null pointer.
     ptrs.push(ptr::null());
 
-    ptrs.as_imm_buf(|buf, _| cb(buf))
+    cb(ptrs.as_ptr())
 }
 
 #[cfg(unix)]
@@ -476,7 +477,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*c_void| -> T) -> T {
             let mut ptrs = tmps.map(|tmp| tmp.with_ref(|buf| buf));
             ptrs.push(ptr::null());
 
-            ptrs.as_imm_buf(|buf, _| unsafe { cb(cast::transmute(buf)) })
+            cb(ptrs.as_ptr() as *c_void)
         }
         _ => cb(ptr::null())
     }
@@ -499,7 +500,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*mut c_void| -> T) -> T {
 
             blk.push(0);
 
-            blk.as_imm_buf(|p, _len| unsafe { cb(cast::transmute(p)) })
+            cb(blk.as_mut_ptr() as *mut c_void)
         }
         _ => cb(ptr::mut_null())
     }