about summary refs log tree commit diff
path: root/src/libstd/net
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-02-12 00:17:24 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-03-08 17:45:44 -0800
commitd46c99abe8671479c48b003bf06e98eda7eb85ab (patch)
tree9cd992343e114fea26c3be8383a2d304e06e4a56 /src/libstd/net
parenteabfc160f87ccc0b296f49af7fe688506580c473 (diff)
downloadrust-d46c99abe8671479c48b003bf06e98eda7eb85ab.tar.gz
rust-d46c99abe8671479c48b003bf06e98eda7eb85ab.zip
std: Funnel read_to_end through to one location
This pushes the implementation detail of proxying `read_to_end` through to
`read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle`
implementations on Unix/Windows. This way intermediate layers will also be able
to take advantage of this optimized implementation.

This commit also adds the optimized implementation for `ChildStdout` and
`ChildStderr`.
Diffstat (limited to 'src/libstd/net')
-rw-r--r--src/libstd/net/tcp.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index f8e3b58bb3e..414696413f4 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -14,7 +14,6 @@ use io::prelude::*;
 use fmt;
 use io;
 use net::{ToSocketAddrs, SocketAddr, Shutdown};
-use sys_common::io::read_to_end_uninitialized;
 use sys_common::net as net_imp;
 use sys_common::{AsInner, FromInner, IntoInner};
 use time::Duration;
@@ -269,7 +268,7 @@ impl TcpStream {
 impl Read for TcpStream {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.0.read(buf) }
     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
-        unsafe { read_to_end_uninitialized(self, buf) }
+        self.0.read_to_end(buf)
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -281,7 +280,7 @@ impl Write for TcpStream {
 impl<'a> Read for &'a TcpStream {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.0.read(buf) }
     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
-        unsafe { read_to_end_uninitialized(self, buf) }
+        self.0.read_to_end(buf)
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]