Skip to content

Commit

Permalink
rustuv: Re-work sockaddr glue to not use malloc
Browse files Browse the repository at this point in the history
This means we can purge even more C from src/rt!
  • Loading branch information
alexcrichton committed Jan 20, 2014
1 parent d4640f9 commit c6123ca
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 208 deletions.
4 changes: 3 additions & 1 deletion src/librustuv/addrinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

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

let mut addrs = ~[];
loop {
let rustaddr = net::sockaddr_to_socket_addr((*addr).ai_addr);
let rustaddr = net::sockaddr_to_addr(cast::transmute((*addr).ai_addr),
(*addr).ai_addrlen as uint);

let mut flags = 0;
each_ai_flag(|cval, aival| {
Expand Down
2 changes: 1 addition & 1 deletion src/librustuv/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ via `close` and `delete` methods.
use std::cast;
use std::io;
use std::io::IoError;
use std::libc::{c_int, malloc};
use std::libc::c_int;
use std::ptr::null;
use std::ptr;
use std::rt::local::Local;
Expand Down
Loading

0 comments on commit c6123ca

Please sign in to comment.