Skip to content

Commit

Permalink
Merge pull request #5 from alexcrichton/uisize
Browse files Browse the repository at this point in the history
Use isize/usize
  • Loading branch information
alexcrichton committed Sep 23, 2015
2 parents a6b8521 + 41e7a69 commit 6ca7818
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 299 deletions.
21 changes: 20 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//! Crate docs
#![allow(bad_style, raw_pointer_derive)]
#![allow(bad_style, raw_pointer_derive, improper_ctypes)]
#![cfg_attr(dox, feature(no_core, lang_items))]
#![cfg_attr(dox, no_core)]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
Expand Down Expand Up @@ -77,6 +77,25 @@ pub type uint16_t = u16;
pub type uint32_t = u32;
pub type uint64_t = u64;

pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;

pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;

pub enum FILE {}
pub enum fpos_t {}
pub enum DIR {}
Expand Down
4 changes: 0 additions & 4 deletions src/unix/bsd/apple/b32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type size_t = u32;
pub type ptrdiff_t = i32;
pub type intptr_t = i32;
pub type uintptr_t = u32;

pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
pub const __PTHREAD_COND_SIZE__: usize = 24;
Expand Down
4 changes: 0 additions & 4 deletions src/unix/bsd/apple/b64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type size_t = u64;
pub type ptrdiff_t = i64;
pub type intptr_t = i64;
pub type uintptr_t = u64;

pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
pub const __PTHREAD_COND_SIZE__: usize = 40;
Expand Down
7 changes: 3 additions & 4 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub type suseconds_t = i32;
pub type dev_t = i32;
pub type ino_t = u64;
pub type mode_t = u16;
pub type ssize_t = c_long;
pub type nlink_t = u16;
pub type blksize_t = i32;
pub type rlim_t = u64;
Expand All @@ -20,9 +19,9 @@ pub enum timezone {}

s! {
pub struct glob_t {
pub gl_pathc: size_t,
pub gl_pathc: ::size_t,
__unused1: ::c_int,
pub gl_offs: size_t,
pub gl_offs: ::size_t,
__unused2: ::c_int,
pub gl_pathv: *mut *mut ::c_char,

Expand Down Expand Up @@ -390,7 +389,7 @@ pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;

pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
pub const PTHREAD_STACK_MIN: size_t = 8192;
pub const PTHREAD_STACK_MIN: ::size_t = 8192;

pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
Expand Down
5 changes: 0 additions & 5 deletions src/unix/bsd/freebsdlike/x86.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type size_t = u32;
pub type ptrdiff_t = i32;
pub type time_t = i32;
pub type suseconds_t = i32;
pub type intptr_t = i32;
pub type uintptr_t = u32;
pub type ssize_t = i32;

s! {
pub struct stat {
Expand Down
5 changes: 0 additions & 5 deletions src/unix/bsd/freebsdlike/x86_64.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type size_t = u64;
pub type ptrdiff_t = i64;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type intptr_t = i64;
pub type uintptr_t = u64;
pub type ssize_t = i64;

s! {
pub struct stat {
Expand Down
6 changes: 3 additions & 3 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub type useconds_t = u32;
pub type blkcnt_t = i64;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type pthread_t = uintptr_t;
pub type pthread_t = ::uintptr_t;

s! {
pub struct sockaddr {
Expand Down Expand Up @@ -76,11 +76,11 @@ pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_V6ONLY: ::c_int = 27;

extern {
pub fn mincore(addr: *const ::c_void, len: size_t,
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const c_char,
mibp: *mut ::c_int,
sizep: *mut size_t)
sizep: *mut ::size_t)
-> ::c_int;
pub fn setgroups(ngroups: ::c_int,
ptr: *const ::gid_t) -> ::c_int;
Expand Down
5 changes: 0 additions & 5 deletions src/unix/bsd/openbsdlike/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type size_t = u64;
pub type ptrdiff_t = i64;
pub type clock_t = i64;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type intptr_t = i64;
pub type uintptr_t = u64;
pub type dev_t = i32;
pub type mode_t = u32;
pub type ssize_t = c_long;
pub type nlink_t = uint32_t;
pub type blksize_t = uint32_t;
pub type ino_t = uint64_t;
Expand Down
Loading

0 comments on commit 6ca7818

Please sign in to comment.