rollup merge of #21444: petrochenkov/null
Conflicts: src/libstd/sync/mpsc/select.rs
This commit is contained in:
commit
907db6c834
|
@ -280,7 +280,7 @@ mod imp {
|
||||||
if align <= MIN_ALIGN {
|
if align <= MIN_ALIGN {
|
||||||
libc::malloc(size as libc::size_t) as *mut u8
|
libc::malloc(size as libc::size_t) as *mut u8
|
||||||
} else {
|
} else {
|
||||||
let mut out = 0 as *mut libc::c_void;
|
let mut out = ptr::null();
|
||||||
let ret = posix_memalign(&mut out,
|
let ret = posix_memalign(&mut out,
|
||||||
align as libc::size_t,
|
align as libc::size_t,
|
||||||
size as libc::size_t);
|
size as libc::size_t);
|
||||||
|
|
|
@ -180,6 +180,7 @@ use std::io::LineBufferedWriter;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::os;
|
use std::os;
|
||||||
|
use std::ptr;
|
||||||
use std::rt;
|
use std::rt;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::sync::{Once, ONCE_INIT};
|
use std::sync::{Once, ONCE_INIT};
|
||||||
|
@ -437,11 +438,11 @@ fn init() {
|
||||||
assert!(!DIRECTIVES.is_null());
|
assert!(!DIRECTIVES.is_null());
|
||||||
let _directives: Box<Vec<directive::LogDirective>> =
|
let _directives: Box<Vec<directive::LogDirective>> =
|
||||||
mem::transmute(DIRECTIVES);
|
mem::transmute(DIRECTIVES);
|
||||||
DIRECTIVES = 0 as *const Vec<directive::LogDirective>;
|
DIRECTIVES = ptr::null();
|
||||||
|
|
||||||
if !FILTER.is_null() {
|
if !FILTER.is_null() {
|
||||||
let _filter: Box<Regex> = mem::transmute(FILTER);
|
let _filter: Box<Regex> = mem::transmute(FILTER);
|
||||||
FILTER = 0 as *const _;
|
FILTER = ptr::null();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub use self::OptimizationDiagnosticKind::*;
|
||||||
pub use self::Diagnostic::*;
|
pub use self::Diagnostic::*;
|
||||||
|
|
||||||
use libc::c_char;
|
use libc::c_char;
|
||||||
|
use std::ptr;
|
||||||
|
|
||||||
use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef};
|
use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef};
|
||||||
|
|
||||||
|
@ -52,10 +53,10 @@ impl OptimizationDiagnostic {
|
||||||
|
|
||||||
let mut opt = OptimizationDiagnostic {
|
let mut opt = OptimizationDiagnostic {
|
||||||
kind: kind,
|
kind: kind,
|
||||||
pass_name: 0 as *const c_char,
|
pass_name: ptr::null(),
|
||||||
function: 0 as ValueRef,
|
function: ptr::null_mut(),
|
||||||
debug_loc: 0 as DebugLocRef,
|
debug_loc: ptr::null_mut(),
|
||||||
message: 0 as TwineRef,
|
message: ptr::null_mut(),
|
||||||
};
|
};
|
||||||
|
|
||||||
super::LLVMUnpackOptimizationDiagnostic(di,
|
super::LLVMUnpackOptimizationDiagnostic(di,
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub use self::Linkage::*;
|
||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::{raw, mem};
|
use std::{raw, mem, ptr};
|
||||||
use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
|
use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
|
||||||
use libc::{c_longlong, c_ulonglong, c_void};
|
use libc::{c_longlong, c_ulonglong, c_void};
|
||||||
use debuginfo::{DIBuilderRef, DIDescriptor,
|
use debuginfo::{DIBuilderRef, DIDescriptor,
|
||||||
|
@ -2262,19 +2262,18 @@ pub unsafe fn static_link_hack_this_sucks() {
|
||||||
LLVMInitializePowerPCAsmPrinter();
|
LLVMInitializePowerPCAsmPrinter();
|
||||||
LLVMInitializePowerPCAsmParser();
|
LLVMInitializePowerPCAsmParser();
|
||||||
|
|
||||||
LLVMRustSetLLVMOptions(0 as c_int,
|
LLVMRustSetLLVMOptions(0 as c_int, ptr::null());
|
||||||
0 as *const _);
|
|
||||||
|
|
||||||
LLVMPassManagerBuilderPopulateModulePassManager(0 as *mut _, 0 as *mut _);
|
LLVMPassManagerBuilderPopulateModulePassManager(ptr::null_mut(), ptr::null_mut());
|
||||||
LLVMPassManagerBuilderPopulateLTOPassManager(0 as *mut _, 0 as *mut _, False, False);
|
LLVMPassManagerBuilderPopulateLTOPassManager(ptr::null_mut(), ptr::null_mut(), False, False);
|
||||||
LLVMPassManagerBuilderPopulateFunctionPassManager(0 as *mut _, 0 as *mut _);
|
LLVMPassManagerBuilderPopulateFunctionPassManager(ptr::null_mut(), ptr::null_mut());
|
||||||
LLVMPassManagerBuilderSetOptLevel(0 as *mut _, 0 as c_uint);
|
LLVMPassManagerBuilderSetOptLevel(ptr::null_mut(), 0 as c_uint);
|
||||||
LLVMPassManagerBuilderUseInlinerWithThreshold(0 as *mut _, 0 as c_uint);
|
LLVMPassManagerBuilderUseInlinerWithThreshold(ptr::null_mut(), 0 as c_uint);
|
||||||
LLVMWriteBitcodeToFile(0 as *mut _, 0 as *const _);
|
LLVMWriteBitcodeToFile(ptr::null_mut(), ptr::null());
|
||||||
LLVMPassManagerBuilderCreate();
|
LLVMPassManagerBuilderCreate();
|
||||||
LLVMPassManagerBuilderDispose(0 as *mut _);
|
LLVMPassManagerBuilderDispose(ptr::null_mut());
|
||||||
|
|
||||||
LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
|
LLVMRustLinkInExternalBitcode(ptr::null_mut(), ptr::null(), 0 as size_t);
|
||||||
|
|
||||||
LLVMLinkInMCJIT();
|
LLVMLinkInMCJIT();
|
||||||
LLVMLinkInInterpreter();
|
LLVMLinkInInterpreter();
|
||||||
|
|
|
@ -21,6 +21,7 @@ use syntax::ast;
|
||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::ptr;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
|
|
||||||
|
@ -295,7 +296,7 @@ impl Type {
|
||||||
if n_elts == 0 {
|
if n_elts == 0 {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
let mut elts: Vec<_> = repeat(Type { rf: 0 as TypeRef }).take(n_elts).collect();
|
let mut elts: Vec<_> = repeat(Type { rf: ptr::null_mut() }).take(n_elts).collect();
|
||||||
llvm::LLVMGetStructElementTypes(self.to_ref(),
|
llvm::LLVMGetStructElementTypes(self.to_ref(),
|
||||||
elts.as_mut_ptr() as *mut TypeRef);
|
elts.as_mut_ptr() as *mut TypeRef);
|
||||||
elts
|
elts
|
||||||
|
@ -309,7 +310,7 @@ impl Type {
|
||||||
pub fn func_params(&self) -> Vec<Type> {
|
pub fn func_params(&self) -> Vec<Type> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let n_args = llvm::LLVMCountParamTypes(self.to_ref()) as uint;
|
let n_args = llvm::LLVMCountParamTypes(self.to_ref()) as uint;
|
||||||
let mut args: Vec<_> = repeat(Type { rf: 0 as TypeRef }).take(n_args).collect();
|
let mut args: Vec<_> = repeat(Type { rf: ptr::null_mut() }).take(n_args).collect();
|
||||||
llvm::LLVMGetParamTypes(self.to_ref(),
|
llvm::LLVMGetParamTypes(self.to_ref(),
|
||||||
args.as_mut_ptr() as *mut TypeRef);
|
args.as_mut_ptr() as *mut TypeRef);
|
||||||
args
|
args
|
||||||
|
|
|
@ -40,6 +40,7 @@ use mem;
|
||||||
use option::Option;
|
use option::Option;
|
||||||
use option::Option::{Some, None};
|
use option::Option::{Some, None};
|
||||||
use ops::{Deref, DerefMut, FnOnce};
|
use ops::{Deref, DerefMut, FnOnce};
|
||||||
|
use ptr;
|
||||||
use result::Result::{Ok, Err};
|
use result::Result::{Ok, Err};
|
||||||
use rt;
|
use rt;
|
||||||
use slice::SliceExt;
|
use slice::SliceExt;
|
||||||
|
@ -238,7 +239,7 @@ pub fn stdin() -> StdinReader {
|
||||||
// Make sure to free it at exit
|
// Make sure to free it at exit
|
||||||
rt::at_exit(|| {
|
rt::at_exit(|| {
|
||||||
mem::transmute::<_, Box<StdinReader>>(STDIN);
|
mem::transmute::<_, Box<StdinReader>>(STDIN);
|
||||||
STDIN = 0 as *const _;
|
STDIN = ptr::null();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ use core::prelude::*;
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::ptr;
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
|
|
||||||
use sync::atomic::{AtomicPtr, Ordering};
|
use sync::atomic::{AtomicPtr, Ordering};
|
||||||
|
@ -82,7 +83,7 @@ unsafe impl<T:Send> Sync for Queue<T> { }
|
||||||
impl<T> Node<T> {
|
impl<T> Node<T> {
|
||||||
unsafe fn new(v: Option<T>) -> *mut Node<T> {
|
unsafe fn new(v: Option<T>) -> *mut Node<T> {
|
||||||
mem::transmute(box Node {
|
mem::transmute(box Node {
|
||||||
next: AtomicPtr::new(0 as *mut Node<T>),
|
next: AtomicPtr::new(ptr::null_mut()),
|
||||||
value: v,
|
value: v,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ use core::prelude::*;
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use core::marker;
|
use core::marker;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::ptr;
|
||||||
use core::uint;
|
use core::uint;
|
||||||
|
|
||||||
use sync::mpsc::{Receiver, RecvError};
|
use sync::mpsc::{Receiver, RecvError};
|
||||||
|
@ -109,7 +110,6 @@ pub trait Packet {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Select {
|
impl Select {
|
||||||
|
|
||||||
/// Creates a new selection structure. This set is initially empty and
|
/// Creates a new selection structure. This set is initially empty and
|
||||||
/// `wait` will panic!() if called.
|
/// `wait` will panic!() if called.
|
||||||
///
|
///
|
||||||
|
@ -117,8 +117,8 @@ impl Select {
|
||||||
/// rather much easier through the `select!` macro.
|
/// rather much easier through the `select!` macro.
|
||||||
pub fn new() -> Select {
|
pub fn new() -> Select {
|
||||||
Select {
|
Select {
|
||||||
head: 0 as *mut Handle<'static, ()>,
|
head: ptr::null_mut(),
|
||||||
tail: 0 as *mut Handle<'static, ()>,
|
tail: ptr::null_mut(),
|
||||||
next_id: Cell::new(1),
|
next_id: Cell::new(1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,8 @@ impl Select {
|
||||||
Handle {
|
Handle {
|
||||||
id: id,
|
id: id,
|
||||||
selector: self,
|
selector: self,
|
||||||
next: 0 as *mut Handle<'static, ()>,
|
next: ptr::null_mut(),
|
||||||
prev: 0 as *mut Handle<'static, ()>,
|
prev: ptr::null_mut(),
|
||||||
added: false,
|
added: false,
|
||||||
rx: rx,
|
rx: rx,
|
||||||
packet: rx,
|
packet: rx,
|
||||||
|
@ -298,8 +298,8 @@ impl<'rx, T: Send> Handle<'rx, T> {
|
||||||
(*self.next).prev = self.prev;
|
(*self.next).prev = self.prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.next = 0 as *mut Handle<'static, ()>;
|
self.next = ptr::null_mut();
|
||||||
self.prev = 0 as *mut Handle<'static, ()>;
|
self.prev = ptr::null_mut();
|
||||||
|
|
||||||
self.added = false;
|
self.added = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ use core::prelude::*;
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::ptr;
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
|
|
||||||
use sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
|
use sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
|
||||||
|
@ -82,7 +83,7 @@ impl<T: Send> Node<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(box Node {
|
mem::transmute(box Node {
|
||||||
value: None,
|
value: None,
|
||||||
next: AtomicPtr::new(0 as *mut Node<T>),
|
next: AtomicPtr::new(ptr::null_mut::<Node<T>>()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +132,7 @@ impl<T: Send> Queue<T> {
|
||||||
let n = self.alloc();
|
let n = self.alloc();
|
||||||
assert!((*n).value.is_none());
|
assert!((*n).value.is_none());
|
||||||
(*n).value = Some(t);
|
(*n).value = Some(t);
|
||||||
(*n).next.store(0 as *mut Node<T>, Ordering::Relaxed);
|
(*n).next.store(ptr::null_mut(), Ordering::Relaxed);
|
||||||
(**self.head.get()).next.store(n, Ordering::Release);
|
(**self.head.get()).next.store(n, Ordering::Release);
|
||||||
*self.head.get() = n;
|
*self.head.get() = n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ use self::Blocker::*;
|
||||||
|
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::ptr;
|
||||||
|
|
||||||
use sync::atomic::{Ordering, AtomicUsize};
|
use sync::atomic::{Ordering, AtomicUsize};
|
||||||
use sync::mpsc::blocking::{self, WaitToken, SignalToken};
|
use sync::mpsc::blocking::{self, WaitToken, SignalToken};
|
||||||
|
@ -145,8 +146,8 @@ impl<T: Send> Packet<T> {
|
||||||
cap: cap,
|
cap: cap,
|
||||||
canceled: None,
|
canceled: None,
|
||||||
queue: Queue {
|
queue: Queue {
|
||||||
head: 0 as *mut Node,
|
head: ptr::null_mut(),
|
||||||
tail: 0 as *mut Node,
|
tail: ptr::null_mut(),
|
||||||
},
|
},
|
||||||
buf: Buffer {
|
buf: Buffer {
|
||||||
buf: range(0, cap + if cap == 0 {1} else {0}).map(|_| None).collect(),
|
buf: range(0, cap + if cap == 0 {1} else {0}).map(|_| None).collect(),
|
||||||
|
@ -160,7 +161,7 @@ impl<T: Send> Packet<T> {
|
||||||
// wait until a send slot is available, returning locked access to
|
// wait until a send slot is available, returning locked access to
|
||||||
// the channel state.
|
// the channel state.
|
||||||
fn acquire_send_slot(&self) -> MutexGuard<State<T>> {
|
fn acquire_send_slot(&self) -> MutexGuard<State<T>> {
|
||||||
let mut node = Node { token: None, next: 0 as *mut Node };
|
let mut node = Node { token: None, next: ptr::null_mut() };
|
||||||
loop {
|
loop {
|
||||||
let mut guard = self.lock.lock().unwrap();
|
let mut guard = self.lock.lock().unwrap();
|
||||||
// are we ready to go?
|
// are we ready to go?
|
||||||
|
@ -343,8 +344,8 @@ impl<T: Send> Packet<T> {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
let mut queue = mem::replace(&mut guard.queue, Queue {
|
let mut queue = mem::replace(&mut guard.queue, Queue {
|
||||||
head: 0 as *mut Node,
|
head: ptr::null_mut(),
|
||||||
tail: 0 as *mut Node,
|
tail: ptr::null_mut(),
|
||||||
});
|
});
|
||||||
|
|
||||||
let waiter = match mem::replace(&mut guard.blocker, NoneBlocked) {
|
let waiter = match mem::replace(&mut guard.blocker, NoneBlocked) {
|
||||||
|
@ -453,7 +454,7 @@ impl Queue {
|
||||||
fn enqueue(&mut self, node: &mut Node) -> WaitToken {
|
fn enqueue(&mut self, node: &mut Node) -> WaitToken {
|
||||||
let (wait_token, signal_token) = blocking::tokens();
|
let (wait_token, signal_token) = blocking::tokens();
|
||||||
node.token = Some(signal_token);
|
node.token = Some(signal_token);
|
||||||
node.next = 0 as *mut Node;
|
node.next = ptr::null_mut();
|
||||||
|
|
||||||
if self.tail.is_null() {
|
if self.tail.is_null() {
|
||||||
self.head = node as *mut Node;
|
self.head = node as *mut Node;
|
||||||
|
@ -475,10 +476,10 @@ impl Queue {
|
||||||
let node = self.head;
|
let node = self.head;
|
||||||
self.head = unsafe { (*node).next };
|
self.head = unsafe { (*node).next };
|
||||||
if self.head.is_null() {
|
if self.head.is_null() {
|
||||||
self.tail = 0 as *mut Node;
|
self.tail = ptr::null_mut();
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
(*node).next = 0 as *mut Node;
|
(*node).next = ptr::null_mut();
|
||||||
Some((*node).token.take().unwrap())
|
Some((*node).token.take().unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ use prelude::v1::*;
|
||||||
|
|
||||||
use cell::UnsafeCell;
|
use cell::UnsafeCell;
|
||||||
use mem;
|
use mem;
|
||||||
|
use ptr;
|
||||||
use rt;
|
use rt;
|
||||||
use sync::{StaticMutex, StaticCondvar};
|
use sync::{StaticMutex, StaticCondvar};
|
||||||
use sync::mpsc::{channel, Sender, Receiver};
|
use sync::mpsc::{channel, Sender, Receiver};
|
||||||
|
@ -132,7 +133,7 @@ impl<M: Send> Helper<M> {
|
||||||
|
|
||||||
// Close the channel by destroying it
|
// Close the channel by destroying it
|
||||||
let chan: Box<Sender<M>> = mem::transmute(*self.chan.get());
|
let chan: Box<Sender<M>> = mem::transmute(*self.chan.get());
|
||||||
*self.chan.get() = 0 as *mut Sender<M>;
|
*self.chan.get() = ptr::null_mut();
|
||||||
drop(chan);
|
drop(chan);
|
||||||
helper_signal::signal(*self.signal.get() as helper_signal::signal);
|
helper_signal::signal(*self.signal.get() as helper_signal::signal);
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
|
||||||
if state.is_null() {
|
if state.is_null() {
|
||||||
return output(w, idx, addr, None)
|
return output(w, idx, addr, None)
|
||||||
}
|
}
|
||||||
let mut data = 0 as *const libc::c_char;
|
let mut data = ptr::null();
|
||||||
let data_addr = &mut data as *mut *const libc::c_char;
|
let data_addr = &mut data as *mut *const libc::c_char;
|
||||||
let ret = unsafe {
|
let ret = unsafe {
|
||||||
backtrace_syminfo(state, addr as libc::uintptr_t,
|
backtrace_syminfo(state, addr as libc::uintptr_t,
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
use cell::UnsafeCell;
|
use cell::UnsafeCell;
|
||||||
use libc;
|
use libc;
|
||||||
|
use ptr;
|
||||||
use std::option::Option::{Some, None};
|
use std::option::Option::{Some, None};
|
||||||
use sys::mutex::{self, Mutex};
|
use sys::mutex::{self, Mutex};
|
||||||
use sys::time;
|
use sys::time;
|
||||||
|
@ -62,7 +63,7 @@ impl Condvar {
|
||||||
// time.
|
// time.
|
||||||
let mut sys_now = libc::timeval { tv_sec: 0, tv_usec: 0 };
|
let mut sys_now = libc::timeval { tv_sec: 0, tv_usec: 0 };
|
||||||
let stable_now = time::SteadyTime::now();
|
let stable_now = time::SteadyTime::now();
|
||||||
let r = ffi::gettimeofday(&mut sys_now, 0 as *mut _);
|
let r = ffi::gettimeofday(&mut sys_now, ptr::null_mut());
|
||||||
debug_assert_eq!(r, 0);
|
debug_assert_eq!(r, 0);
|
||||||
|
|
||||||
let seconds = NumCast::from(dur.num_seconds());
|
let seconds = NumCast::from(dur.num_seconds());
|
||||||
|
|
|
@ -19,6 +19,7 @@ use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append};
|
||||||
use io;
|
use io;
|
||||||
use libc::{self, c_int, c_void};
|
use libc::{self, c_int, c_void};
|
||||||
use mem;
|
use mem;
|
||||||
|
use ptr;
|
||||||
use sys::retry;
|
use sys::retry;
|
||||||
use sys_common::{keep_going, eof, mkerr_libc};
|
use sys_common::{keep_going, eof, mkerr_libc};
|
||||||
|
|
||||||
|
@ -207,7 +208,7 @@ pub fn readdir(p: &Path) -> IoResult<Vec<Path>> {
|
||||||
|
|
||||||
if dir_ptr as uint != 0 {
|
if dir_ptr as uint != 0 {
|
||||||
let mut paths = vec!();
|
let mut paths = vec!();
|
||||||
let mut entry_ptr = 0 as *mut dirent_t;
|
let mut entry_ptr = ptr::null_mut();
|
||||||
while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } {
|
while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } {
|
||||||
if entry_ptr.is_null() { break }
|
if entry_ptr.is_null() { break }
|
||||||
paths.push(unsafe {
|
paths.push(unsafe {
|
||||||
|
|
|
@ -143,7 +143,7 @@ pub unsafe fn get_env_pairs() -> Vec<Vec<u8>> {
|
||||||
os::last_os_error());
|
os::last_os_error());
|
||||||
}
|
}
|
||||||
let mut result = Vec::new();
|
let mut result = Vec::new();
|
||||||
while *environ != 0 as *const _ {
|
while *environ != ptr::null() {
|
||||||
let env_pair = ffi::c_str_to_bytes(&*environ).to_vec();
|
let env_pair = ffi::c_str_to_bytes(&*environ).to_vec();
|
||||||
result.push(env_pair);
|
result.push(env_pair);
|
||||||
environ = environ.offset(1);
|
environ = environ.offset(1);
|
||||||
|
|
|
@ -251,7 +251,7 @@ impl Process {
|
||||||
fn setgroups(ngroups: libc::c_int,
|
fn setgroups(ngroups: libc::c_int,
|
||||||
ptr: *const libc::c_void) -> libc::c_int;
|
ptr: *const libc::c_void) -> libc::c_int;
|
||||||
}
|
}
|
||||||
let _ = setgroups(0, 0 as *const libc::c_void);
|
let _ = setgroups(0, ptr::null());
|
||||||
|
|
||||||
if libc::setuid(u as libc::uid_t) != 0 {
|
if libc::setuid(u as libc::uid_t) != 0 {
|
||||||
fail(&mut output);
|
fail(&mut output);
|
||||||
|
|
|
@ -327,7 +327,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
|
||||||
let image = arch::init_frame(&mut frame, &context);
|
let image = arch::init_frame(&mut frame, &context);
|
||||||
|
|
||||||
// Initialize this process's symbols
|
// Initialize this process's symbols
|
||||||
let ret = SymInitialize(process, 0 as *mut libc::c_void, libc::TRUE);
|
let ret = SymInitialize(process, ptr::null_mut(), libc::TRUE);
|
||||||
if ret != libc::TRUE { return Ok(()) }
|
if ret != libc::TRUE { return Ok(()) }
|
||||||
let _c = Cleanup { handle: process, SymCleanup: SymCleanup };
|
let _c = Cleanup { handle: process, SymCleanup: SymCleanup };
|
||||||
|
|
||||||
|
@ -335,10 +335,10 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
|
||||||
let mut i = 0i;
|
let mut i = 0i;
|
||||||
try!(write!(w, "stack backtrace:\n"));
|
try!(write!(w, "stack backtrace:\n"));
|
||||||
while StackWalk64(image, process, thread, &mut frame, &mut context,
|
while StackWalk64(image, process, thread, &mut frame, &mut context,
|
||||||
0 as *mut libc::c_void,
|
ptr::null_mut(),
|
||||||
0 as *mut libc::c_void,
|
ptr::null_mut(),
|
||||||
0 as *mut libc::c_void,
|
ptr::null_mut(),
|
||||||
0 as *mut libc::c_void) == libc::TRUE{
|
ptr::null_mut()) == libc::TRUE{
|
||||||
let addr = frame.AddrPC.Offset;
|
let addr = frame.AddrPC.Offset;
|
||||||
if addr == frame.AddrReturn.Offset || addr == 0 ||
|
if addr == frame.AddrReturn.Offset || addr == 0 ||
|
||||||
frame.AddrReturn.Offset == 0 { break }
|
frame.AddrReturn.Offset == 0 { break }
|
||||||
|
|
|
@ -137,7 +137,7 @@ unsafe fn init_dtors() {
|
||||||
rt::at_exit(move|| {
|
rt::at_exit(move|| {
|
||||||
DTOR_LOCK.lock();
|
DTOR_LOCK.lock();
|
||||||
let dtors = DTORS;
|
let dtors = DTORS;
|
||||||
DTORS = 0 as *mut _;
|
DTORS = ptr::null_mut();
|
||||||
mem::transmute::<_, Box<Vec<(Key, Dtor)>>>(dtors);
|
mem::transmute::<_, Box<Vec<(Key, Dtor)>>>(dtors);
|
||||||
assert!(DTORS.is_null()); // can't re-init after destructing
|
assert!(DTORS.is_null()); // can't re-init after destructing
|
||||||
DTOR_LOCK.unlock();
|
DTOR_LOCK.unlock();
|
||||||
|
@ -250,7 +250,7 @@ unsafe fn run_dtors() {
|
||||||
for &(key, dtor) in dtors.iter() {
|
for &(key, dtor) in dtors.iter() {
|
||||||
let ptr = TlsGetValue(key);
|
let ptr = TlsGetValue(key);
|
||||||
if !ptr.is_null() {
|
if !ptr.is_null() {
|
||||||
TlsSetValue(key, 0 as *mut _);
|
TlsSetValue(key, ptr::null_mut());
|
||||||
dtor(ptr as *mut _);
|
dtor(ptr as *mut _);
|
||||||
any_run = true;
|
any_run = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,7 +425,7 @@ mod imp {
|
||||||
dtor(ptr);
|
dtor(ptr);
|
||||||
}
|
}
|
||||||
ptr = DTORS.get();
|
ptr = DTORS.get();
|
||||||
DTORS.set(0 as *mut _);
|
DTORS.set(ptr::null_mut());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ mod imp {
|
||||||
let key = ptr.key;
|
let key = ptr.key;
|
||||||
key.os.set(1 as *mut u8);
|
key.os.set(1 as *mut u8);
|
||||||
drop(ptr);
|
drop(ptr);
|
||||||
key.os.set(0 as *mut u8);
|
key.os.set(ptr::null_mut());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue