std: Move size/align functions to std::mem. #2240

This commit is contained in:
Brian Anderson 2013-10-16 18:34:01 -07:00
parent 3fd0e3a77b
commit 34d376f3cf
46 changed files with 288 additions and 269 deletions

View file

@ -233,6 +233,6 @@ fn align_down(sp: *mut uint) -> *mut uint {
// ptr::mut_offset is positive ints only
#[inline]
pub fn mut_offset<T>(ptr: *mut T, count: int) -> *mut T {
use std::sys::size_of;
use mem::size_of;
(ptr as int + count * (size_of::<T>() as int)) as *mut T
}

View file

@ -11,7 +11,7 @@
use libc::{c_void, c_char, size_t, uintptr_t, free, malloc, realloc};
use unstable::intrinsics::TyDesc;
use unstable::raw;
use sys::size_of;
use mem::size_of;
extern {
#[rust_stack]

View file

@ -271,12 +271,12 @@ fn spawn_process_os(prog: &str, args: &[~str],
};
use libc::funcs::extra::msvcrt::get_osfhandle;
use sys;
use mem;
unsafe {
let mut si = zeroed_startupinfo();
si.cb = sys::size_of::<STARTUPINFO>() as DWORD;
si.cb = mem::size_of::<STARTUPINFO>() as DWORD;
si.dwFlags = STARTF_USESTDHANDLES;
let cur_proc = GetCurrentProcess();

View file

@ -857,7 +857,7 @@ fn new_sched_rng() -> XorShiftRng {
#[fixed_stack_segment] #[inline(never)]
fn new_sched_rng() -> XorShiftRng {
use libc;
use sys;
use mem;
use c_str::ToCStr;
use vec::MutableVector;
use iter::Iterator;
@ -871,7 +871,7 @@ fn new_sched_rng() -> XorShiftRng {
}
let mut seeds = [0u32, .. 4];
let size = sys::size_of_val(&seeds);
let size = mem::size_of_val(&seeds);
loop {
let nbytes = do seeds.as_mut_buf |buf, _| {
unsafe {

View file

@ -103,7 +103,7 @@ mod darwin_fd_limit {
// The strategy here is to fetch the current resource limits, read the kern.maxfilesperproc
// sysctl value, and bump the soft resource limit for maxfiles up to the sysctl value.
use ptr::{to_unsafe_ptr, to_mut_unsafe_ptr, mut_null};
use sys::size_of_val;
use mem::size_of_val;
use os::last_os_error;
// Fetch the kern.maxfilesperproc value