Skip to content

Commit cc42b61

Browse files
committed
Handle fallout in io::net::addrinfo, io::process, and rt::rtio
API Changes: - get_host_addresses() returns IoResult<Vec<IpAddr>> - Process.extra_io is Vec<Option<io::PipeStream>>
1 parent f340fb9 commit cc42b61

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/libstd/io/net/addrinfo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use io::IoResult;
2424
use io::net::ip::{SocketAddr, IpAddr};
2525
use option::{Option, Some, None};
2626
use rt::rtio::{IoFactory, LocalIo};
27-
use slice::OwnedVector;
27+
use vec::Vec;
2828

2929
/// Hints to the types of sockets that are desired when looking up hosts
3030
pub enum SocketType {
@@ -73,7 +73,7 @@ pub struct Info {
7373

7474
/// Easy name resolution. Given a hostname, returns the list of IP addresses for
7575
/// that hostname.
76-
pub fn get_host_addresses(host: &str) -> IoResult<~[IpAddr]> {
76+
pub fn get_host_addresses(host: &str) -> IoResult<Vec<IpAddr>> {
7777
lookup(Some(host), None, None).map(|a| a.move_iter().map(|i| i.address.ip).collect())
7878
}
7979

@@ -90,7 +90,7 @@ pub fn get_host_addresses(host: &str) -> IoResult<~[IpAddr]> {
9090
/// FIXME: this is not public because the `Hint` structure is not ready for public
9191
/// consumption just yet.
9292
fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
93-
-> IoResult<~[Info]> {
93+
-> IoResult<Vec<Info>> {
9494
LocalIo::maybe_raise(|io| io.get_host_addresses(hostname, servname, hint))
9595
}
9696

src/libstd/io/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub struct Process {
6969

7070
/// Extra I/O handles as configured by the original `ProcessConfig` when
7171
/// this process was created. This is by default empty.
72-
pub extra_io: ~[Option<io::PipeStream>],
72+
pub extra_io: Vec<Option<io::PipeStream>>,
7373
}
7474

7575
/// This configuration describes how a new process should be spawned. A blank
@@ -418,7 +418,7 @@ impl Drop for Process {
418418
drop(self.stdin.take());
419419
drop(self.stdout.take());
420420
drop(self.stderr.take());
421-
drop(mem::replace(&mut self.extra_io, box []));
421+
drop(mem::replace(&mut self.extra_io, Vec::new()));
422422

423423
self.wait();
424424
}

src/libstd/rt/rtio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub trait IoFactory {
161161
fn unix_connect(&mut self, path: &CString,
162162
timeout: Option<u64>) -> IoResult<Box<RtioPipe:Send>>;
163163
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
164-
hint: Option<ai::Hint>) -> IoResult<~[ai::Info]>;
164+
hint: Option<ai::Hint>) -> IoResult<Vec<ai::Info>>;
165165

166166
// filesystem operations
167167
fn fs_from_raw_fd(&mut self, fd: c_int, close: CloseBehavior)

0 commit comments

Comments
 (0)