about 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-15 23:05:30 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2013-12-15 23:05:30 +1100
commitf53292f7ee7365fe50ac216efac438ff5569fd06 (patch)
tree269b181beb06c1701eff224eaecfc1e4dd6d793d /src/libstd/io
parent4f62c969f618463914b148d53bef1d0faeb2782f (diff)
Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}.
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/buffered.rs4
-rw-r--r--src/libstd/io/mod.rs4
-rw-r--r--src/libstd/io/native/file.rs2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 1922af3a3b7..fb06a4dfdb4 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -79,7 +79,7 @@ impl<R: Reader> BufferedReader<R> {
         // to be very cheap (large mallocs are not nearly as expensive as large
         // callocs).
         let mut buf = vec::with_capacity(cap);
-        unsafe { vec::raw::set_len(&mut buf, cap); }
+        unsafe { buf.set_len(cap); }
         BufferedReader {
             inner: inner,
             buf: buf,
@@ -154,7 +154,7 @@ impl<W: Writer> BufferedWriter<W> {
     pub fn with_capacity(cap: uint, inner: W) -> BufferedWriter<W> {
         // See comments in BufferedReader for why this uses unsafe code.
         let mut buf = vec::with_capacity(cap);
-        unsafe { vec::raw::set_len(&mut buf, cap); }
+        unsafe { buf.set_len(cap); }
         BufferedWriter {
             inner: inner,
             buf: buf,
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index c5ae6457515..53d79e70c86 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -523,7 +523,7 @@ pub trait Reader {
             let mut total_read = 0;
 
             buf.reserve_additional(len);
-            vec::raw::set_len(buf, start_len + len);
+            buf.set_len(start_len + len);
 
             (|| {
                 while total_read < len {
@@ -539,7 +539,7 @@ pub trait Reader {
                         }
                     }
                 }
-            }).finally(|| vec::raw::set_len(buf, start_len + total_read))
+            }).finally(|| buf.set_len(start_len + total_read))
         }
     }
 
diff --git a/src/libstd/io/native/file.rs b/src/libstd/io/native/file.rs
index 7b5104657d9..4e1c6bf982a 100644
--- a/src/libstd/io/native/file.rs
+++ b/src/libstd/io/native/file.rs
@@ -706,7 +706,7 @@ pub fn readlink(p: &CString) -> IoResult<Path> {
             -1 => Err(super::last_error()),
             n => {
                 assert!(n > 0);
-                unsafe { vec::raw::set_len(&mut buf, n as uint); }
+                unsafe { buf.set_len(n as uint); }
                 Ok(Path::new(buf))
             }
         }