auto merge of #9619 : toffaletti/rust/mmap, r=huonw

This commit is contained in:
bors 2013-09-30 05:01:23 -07:00
commit 8174618a05
1 changed files with 7 additions and 7 deletions

View File

@ -1398,7 +1398,7 @@ impl to_str::ToStr for MapError {
#[cfg(unix)] #[cfg(unix)]
impl MemoryMap { impl MemoryMap {
pub fn new(min_len: uint, options: ~[MapOption]) -> Result<~MemoryMap, MapError> { pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> {
#[fixed_stack_segment]; #[inline(never)]; #[fixed_stack_segment]; #[inline(never)];
use libc::off_t; use libc::off_t;
@ -1441,7 +1441,7 @@ impl MemoryMap {
code => ErrUnknown(code) code => ErrUnknown(code)
}) })
} else { } else {
Ok(~MemoryMap { Ok(MemoryMap {
data: r as *mut u8, data: r as *mut u8,
len: len, len: len,
kind: if fd == -1 { kind: if fd == -1 {
@ -1478,7 +1478,7 @@ impl Drop for MemoryMap {
#[cfg(windows)] #[cfg(windows)]
impl MemoryMap { impl MemoryMap {
pub fn new(min_len: uint, options: ~[MapOption]) -> Result<~MemoryMap, MapError> { pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> {
#[fixed_stack_segment]; #[inline(never)]; #[fixed_stack_segment]; #[inline(never)];
use libc::types::os::arch::extra::{LPVOID, DWORD, SIZE_T, HANDLE}; use libc::types::os::arch::extra::{LPVOID, DWORD, SIZE_T, HANDLE};
@ -1524,7 +1524,7 @@ impl MemoryMap {
}; };
match r as uint { match r as uint {
0 => Err(ErrVirtualAlloc(errno())), 0 => Err(ErrVirtualAlloc(errno())),
_ => Ok(~MemoryMap { _ => Ok(MemoryMap {
data: r as *mut u8, data: r as *mut u8,
len: len, len: len,
kind: MapVirtual kind: MapVirtual
@ -1560,7 +1560,7 @@ impl MemoryMap {
0); 0);
match r as uint { match r as uint {
0 => Err(ErrMapViewOfFile(errno())), 0 => Err(ErrMapViewOfFile(errno())),
_ => Ok(~MemoryMap { _ => Ok(MemoryMap {
data: r as *mut u8, data: r as *mut u8,
len: len, len: len,
kind: MapFile(mapping as *c_void) kind: MapFile(mapping as *c_void)
@ -1996,7 +1996,7 @@ mod tests {
fn memory_map_rw() { fn memory_map_rw() {
use result::{Ok, Err}; use result::{Ok, Err};
let chunk = match os::MemoryMap::new(16, ~[ let chunk = match os::MemoryMap::new(16, [
os::MapReadable, os::MapReadable,
os::MapWritable os::MapWritable
]) { ]) {
@ -2050,7 +2050,7 @@ mod tests {
} }
fd fd
}; };
let chunk = match MemoryMap::new(size / 2, ~[ let chunk = match MemoryMap::new(size / 2, [
MapReadable, MapReadable,
MapWritable, MapWritable,
MapFd(fd), MapFd(fd),