Skip to content

Commit c6123ca

Browse files
committed
rustuv: Re-work sockaddr glue to not use malloc
This means we can purge even more C from src/rt!
1 parent d4640f9 commit c6123ca

File tree

5 files changed

+158
-208
lines changed

5 files changed

+158
-208
lines changed

Diff for: src/librustuv/addrinfo.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
use ai = std::io::net::addrinfo;
12+
use std::cast;
1213
use std::libc::c_int;
1314
use std::ptr::null;
1415
use std::rt::task::BlockedTask;
@@ -138,7 +139,8 @@ pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] {
138139

139140
let mut addrs = ~[];
140141
loop {
141-
let rustaddr = net::sockaddr_to_socket_addr((*addr).ai_addr);
142+
let rustaddr = net::sockaddr_to_addr(cast::transmute((*addr).ai_addr),
143+
(*addr).ai_addrlen as uint);
142144

143145
let mut flags = 0;
144146
each_ai_flag(|cval, aival| {

Diff for: src/librustuv/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ via `close` and `delete` methods.
4747
use std::cast;
4848
use std::io;
4949
use std::io::IoError;
50-
use std::libc::{c_int, malloc};
50+
use std::libc::c_int;
5151
use std::ptr::null;
5252
use std::ptr;
5353
use std::rt::local::Local;

0 commit comments

Comments
 (0)