Fallout - change array syntax to use ;

This commit is contained in:
Nick Cameron 2014-12-30 21:19:41 +13:00
parent 57a74eda88
commit 7e2b9ea235
66 changed files with 223 additions and 222 deletions

View file

@ -123,7 +123,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
try!(writeln!(w, "stack backtrace:"));
// 100 lines should be enough
const SIZE: uint = 100;
let mut buf: [*mut libc::c_void, ..SIZE] = unsafe {mem::zeroed()};
let mut buf: [*mut libc::c_void; SIZE] = unsafe {mem::zeroed()};
let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as uint};
// skipping the first one as it is write itself
@ -320,7 +320,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
// tested if this is required or not.
unsafe fn init_state() -> *mut backtrace_state {
static mut STATE: *mut backtrace_state = 0 as *mut backtrace_state;
static mut LAST_FILENAME: [libc::c_char, ..256] = [0, ..256];
static mut LAST_FILENAME: [libc::c_char; 256] = [0; 256];
if !STATE.is_null() { return STATE }
let selfname = if cfg!(target_os = "freebsd") ||
cfg!(target_os = "dragonfly") {

View file

@ -168,13 +168,13 @@ mod signal {
#[repr(C)]
#[cfg(target_word_size = "32")]
pub struct sigset_t {
__val: [libc::c_ulong, ..32],
__val: [libc::c_ulong; 32],
}
#[repr(C)]
#[cfg(target_word_size = "64")]
pub struct sigset_t {
__val: [libc::c_ulong, ..16],
__val: [libc::c_ulong; 16],
}
}
@ -211,7 +211,7 @@ mod signal {
pub sa_handler: extern fn(libc::c_int),
pub sa_mask: sigset_t,
sa_restorer: *mut libc::c_void,
sa_resv: [libc::c_int, ..1],
sa_resv: [libc::c_int; 1],
}
unsafe impl ::kinds::Send for sigaction { }
@ -219,7 +219,7 @@ mod signal {
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong, ..32],
__val: [libc::c_ulong; 32],
}
}
@ -244,7 +244,7 @@ mod signal {
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
#[repr(C)]
pub struct sigset_t {
bits: [u32, ..4],
bits: [u32; 4],
}
// This structure has more fields, but we're not all that interested in

View file

@ -372,7 +372,7 @@ mod tests {
let mut writer = FileDesc::new(writer, true);
writer.write(b"test").ok().unwrap();
let mut buf = [0u8, ..4];
let mut buf = [0u8; 4];
match reader.read(&mut buf) {
Ok(4) => {
assert_eq!(buf[0], 't' as u8);

View file

@ -113,7 +113,7 @@ pub fn error_string(errno: i32) -> String {
}
pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> {
let mut fds = [0, ..2];
let mut fds = [0; 2];
if libc::pipe(fds.as_mut_ptr()) == 0 {
Ok((FileDesc::new(fds[0], true), FileDesc::new(fds[1], true)))
} else {

View file

@ -120,7 +120,7 @@ impl Process {
let p = Process{ pid: pid };
drop(output);
let mut bytes = [0, ..8];
let mut bytes = [0; 8];
return match input.read(&mut bytes) {
Ok(8) => {
assert!(combine(CLOEXEC_MSG_FOOTER) == combine(bytes.slice(4, 8)),
@ -348,7 +348,7 @@ impl Process {
// handler we're going to start receiving signals.
fn register_sigchld() -> (libc::c_int, c::sigaction) {
unsafe {
let mut pipes = [0, ..2];
let mut pipes = [0; 2];
assert_eq!(libc::pipe(pipes.as_mut_ptr()), 0);
set_nonblocking(pipes[0], true).ok().unwrap();
set_nonblocking(pipes[1], true).ok().unwrap();
@ -482,7 +482,7 @@ impl Process {
fn drain(fd: libc::c_int) -> bool {
let mut ret = false;
loop {
let mut buf = [0u8, ..1];
let mut buf = [0u8; 1];
match unsafe {
libc::read(fd, buf.as_mut_ptr() as *mut libc::c_void,
buf.len() as libc::size_t)

View file

@ -184,12 +184,12 @@ mod imp {
#[cfg(target_word_size = "32")]
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong, ..32],
__val: [libc::c_ulong; 32],
}
#[cfg(target_word_size = "64")]
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong, ..16],
__val: [libc::c_ulong; 16],
}
#[repr(C)]

View file

@ -187,7 +187,7 @@ mod os {
writerThreadId: libc::c_int,
pendingReaders: libc::c_int,
pendingWriters: libc::c_int,
reserved: [*mut libc::c_void, ..4],
reserved: [*mut libc::c_void; 4],
}
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
@ -203,6 +203,6 @@ mod os {
writerThreadId: 0,
pendingReaders: 0,
pendingWriters: 0,
reserved: [0 as *mut _, ..4],
reserved: [0 as *mut _; 4],
};
}

View file

@ -68,7 +68,7 @@ const IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664;
struct SYMBOL_INFO {
SizeOfStruct: libc::c_ulong,
TypeIndex: libc::c_ulong,
Reserved: [u64, ..2],
Reserved: [u64; 2],
Index: libc::c_ulong,
Size: libc::c_ulong,
ModBase: u64,
@ -108,10 +108,10 @@ struct STACKFRAME64 {
AddrStack: ADDRESS64,
AddrBStore: ADDRESS64,
FuncTableEntry: *mut libc::c_void,
Params: [u64, ..4],
Params: [u64; 4],
Far: libc::BOOL,
Virtual: libc::BOOL,
Reserved: [u64, ..3],
Reserved: [u64; 3],
KdHelp: KDHELP64,
}
@ -127,7 +127,7 @@ struct KDHELP64 {
KiUserExceptionDispatcher: u64,
StackBase: u64,
StackLimit: u64,
Reserved: [u64, ..5],
Reserved: [u64; 5],
}
#[cfg(target_arch = "x86")]
@ -174,7 +174,7 @@ mod arch {
ErrorSelector: libc::DWORD,
DataOffset: libc::DWORD,
DataSelector: libc::DWORD,
RegisterArea: [u8, ..80],
RegisterArea: [u8; 80],
Cr0NpxState: libc::DWORD,
}
@ -198,7 +198,7 @@ mod arch {
#[repr(C)]
pub struct CONTEXT {
_align_hack: [simd::u64x2, ..0], // FIXME align on 16-byte
_align_hack: [simd::u64x2; 0], // FIXME align on 16-byte
P1Home: DWORDLONG,
P2Home: DWORDLONG,
P3Home: DWORDLONG,
@ -257,15 +257,15 @@ mod arch {
#[repr(C)]
pub struct M128A {
_align_hack: [simd::u64x2, ..0], // FIXME align on 16-byte
_align_hack: [simd::u64x2; 0], // FIXME align on 16-byte
Low: c_ulonglong,
High: c_longlong
}
#[repr(C)]
pub struct FLOATING_SAVE_AREA {
_align_hack: [simd::u64x2, ..0], // FIXME align on 16-byte
_Dummy: [u8, ..512] // FIXME: Fill this out
_align_hack: [simd::u64x2; 0], // FIXME align on 16-byte
_Dummy: [u8; 512] // FIXME: Fill this out
}
pub fn init_frame(frame: &mut super::STACKFRAME64,

View file

@ -112,7 +112,7 @@ pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> {
// fully understand. Here we explicitly make the pipe non-inheritable,
// which means to pass it to a subprocess they need to be duplicated
// first, as in std::run.
let mut fds = [0, ..2];
let mut fds = [0; 2];
match libc::pipe(fds.as_mut_ptr(), 1024 as ::libc::c_uint,
(libc::O_BINARY | libc::O_NOINHERIT) as c_int) {
0 => {