Tidy
This commit is contained in:
parent
fae3336769
commit
7826651335
@ -147,15 +147,15 @@ impl DebugPrints for io::fd_t {
|
||||
fn write_hex(&self, mut i: uint) {
|
||||
let letters = ['0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
'9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
||||
static uint_nibbles: uint = ::uint::bytes << 1;
|
||||
let mut buffer = [0_u8, ..uint_nibbles+1];
|
||||
let mut c = uint_nibbles;
|
||||
static UINT_NIBBLES: uint = ::uint::bytes << 1;
|
||||
let mut buffer = [0_u8, ..UINT_NIBBLES+1];
|
||||
let mut c = UINT_NIBBLES;
|
||||
while c > 0 {
|
||||
c -= 1;
|
||||
buffer[c] = letters[i & 0xF] as u8;
|
||||
i >>= 4;
|
||||
}
|
||||
self.write(buffer.slice(0, uint_nibbles));
|
||||
self.write(buffer.slice(0, UINT_NIBBLES));
|
||||
}
|
||||
|
||||
unsafe fn write_cstr(&self, p: *c_char) {
|
||||
|
@ -80,7 +80,7 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
|
||||
#[cfg(not(stage0), not(test))]
|
||||
#[lang="exchange_malloc"]
|
||||
#[inline]
|
||||
pub unsafe fn exchange_malloc(align: u32, size: uintptr_t) -> *c_char {
|
||||
pub unsafe fn exchange_malloc(_align: u32, size: uintptr_t) -> *c_char {
|
||||
malloc_raw(size as uint) as *c_char
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ fn uv_ip_as_ip<T>(addr: UvIpAddr, f: &fn(IpAddr) -> T) -> T {
|
||||
let ip_str = str::from_bytes_slice(ip_name).trim_right_chars(&'\x00');
|
||||
let ip = match addr {
|
||||
UvIpv4(*) => {
|
||||
let ip: ~[u8] =
|
||||
let ip: ~[u8] =
|
||||
ip_str.split_iter('.')
|
||||
.transform(|s: &str| -> u8 { FromStr::from_str(s).unwrap() })
|
||||
.collect();
|
||||
@ -288,8 +288,10 @@ impl TcpWatcher {
|
||||
rtdebug!("connect_t: %x", connect_handle as uint);
|
||||
do ip_as_uv_ip(address) |addr| {
|
||||
let result = match addr {
|
||||
UvIpv4(addr) => uvll::tcp_connect(connect_handle, self.native_handle(), addr, connect_cb),
|
||||
UvIpv6(addr) => uvll::tcp_connect6(connect_handle, self.native_handle(), addr, connect_cb),
|
||||
UvIpv4(addr) => uvll::tcp_connect(connect_handle,
|
||||
self.native_handle(), addr, connect_cb),
|
||||
UvIpv6(addr) => uvll::tcp_connect6(connect_handle,
|
||||
self.native_handle(), addr, connect_cb),
|
||||
};
|
||||
assert_eq!(0, result);
|
||||
}
|
||||
@ -416,8 +418,10 @@ impl UdpWatcher {
|
||||
do ip_as_uv_ip(address) |addr| {
|
||||
let result = unsafe {
|
||||
match addr {
|
||||
UvIpv4(addr) => uvll::udp_send(req.native_handle(), self.native_handle(), [buf], addr, send_cb),
|
||||
UvIpv6(addr) => uvll::udp_send6(req.native_handle(), self.native_handle(), [buf], addr, send_cb),
|
||||
UvIpv4(addr) => uvll::udp_send(req.native_handle(),
|
||||
self.native_handle(), [buf], addr, send_cb),
|
||||
UvIpv6(addr) => uvll::udp_send6(req.native_handle(),
|
||||
self.native_handle(), [buf], addr, send_cb),
|
||||
}
|
||||
};
|
||||
assert_eq!(0, result);
|
||||
|
@ -32,14 +32,12 @@ use sys::size_of;
|
||||
use uint;
|
||||
use unstable::intrinsics;
|
||||
#[cfg(stage0)]
|
||||
use intrinsic::{get_tydesc, TyDesc};
|
||||
use intrinsic::{get_tydesc};
|
||||
#[cfg(not(stage0))]
|
||||
use unstable::intrinsics::{get_tydesc, contains_managed, TyDesc};
|
||||
use unstable::intrinsics::{get_tydesc, contains_managed};
|
||||
use vec;
|
||||
use util;
|
||||
|
||||
#[cfg(not(test))] use cmp::Equiv;
|
||||
|
||||
/// Returns true if two vectors have the same length
|
||||
pub fn same_length<T, U>(xs: &[T], ys: &[U]) -> bool {
|
||||
xs.len() == ys.len()
|
||||
|
Loading…
Reference in New Issue
Block a user