Fix compilation on linux
This commit is contained in:
committed by
Aaron Turon
parent
9644d60cc4
commit
7a6c54c46e
@@ -57,7 +57,6 @@ use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
|
|||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
#[cfg(unix)] use c_str::ToCStr;
|
#[cfg(unix)] use c_str::ToCStr;
|
||||||
#[cfg(unix)] use libc::c_char;
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub use sys::ext as unix;
|
pub use sys::ext as unix;
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ mod imp {
|
|||||||
use string::String;
|
use string::String;
|
||||||
use mem;
|
use mem;
|
||||||
|
|
||||||
use sync::mutex::{StaticMutex, MUTEX_INIT};
|
use sync::{StaticMutex, MUTEX_INIT};
|
||||||
|
|
||||||
static mut GLOBAL_ARGS_PTR: uint = 0;
|
static mut GLOBAL_ARGS_PTR: uint = 0;
|
||||||
static LOCK: NativeMutex = MUTEX_INIT;
|
static LOCK: StaticMutex = MUTEX_INIT;
|
||||||
|
|
||||||
pub unsafe fn init(argc: int, argv: *const *const u8) {
|
pub unsafe fn init(argc: int, argv: *const *const u8) {
|
||||||
let args = load_argc_and_argv(argc, argv);
|
let args = load_argc_and_argv(argc, argv);
|
||||||
@@ -67,7 +67,7 @@ mod imp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn take() -> Option<Vec<Vec<u8>>> {
|
pub fn take() -> Option<Vec<Vec<u8>>> {
|
||||||
let guard = LOCK.lock();
|
let _guard = LOCK.lock();
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = get_global_ptr();
|
let ptr = get_global_ptr();
|
||||||
let val = mem::replace(&mut *ptr, None);
|
let val = mem::replace(&mut *ptr, None);
|
||||||
@@ -76,7 +76,7 @@ mod imp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn put(args: Vec<Vec<u8>>) {
|
pub fn put(args: Vec<Vec<u8>>) {
|
||||||
let guard = LOCK.lock();
|
let _guard = LOCK.lock();
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = get_global_ptr();
|
let ptr = get_global_ptr();
|
||||||
rtassert!((*ptr).is_none());
|
rtassert!((*ptr).is_none());
|
||||||
@@ -85,7 +85,7 @@ mod imp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn clone() -> Option<Vec<Vec<u8>>> {
|
pub fn clone() -> Option<Vec<Vec<u8>>> {
|
||||||
let guard = LOCK.lock();
|
let _guard = LOCK.lock();
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = get_global_ptr();
|
let ptr = get_global_ptr();
|
||||||
(*ptr).as_ref().map(|s: &Box<Vec<Vec<u8>>>| (**s).clone())
|
(*ptr).as_ref().map(|s: &Box<Vec<Vec<u8>>>| (**s).clone())
|
||||||
@@ -104,8 +104,8 @@ mod imp {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::prelude::*;
|
use prelude::*;
|
||||||
use std::finally::Finally;
|
use finally::Finally;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
|
|||||||
|
|
||||||
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
||||||
fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
|
fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
|
||||||
use iter::Iterator;
|
use iter::{Iterator, IteratorExt};
|
||||||
use os;
|
use os;
|
||||||
use path::GenericPath;
|
use path::GenericPath;
|
||||||
use ptr::RawPtr;
|
use ptr::RawPtr;
|
||||||
|
|||||||
Reference in New Issue
Block a user