Skip to content

Commit 6ca7818

Browse files
committed
Merge pull request #5 from alexcrichton/uisize
Use isize/usize
2 parents a6b8521 + 41e7a69 commit 6ca7818

File tree

15 files changed

+232
-299
lines changed

15 files changed

+232
-299
lines changed

src/lib.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

80+
pub type c_schar = i8;
81+
pub type c_uchar = u8;
82+
pub type c_short = i16;
83+
pub type c_ushort = u16;
84+
pub type c_int = i32;
85+
pub type c_uint = u32;
86+
pub type c_float = f32;
87+
pub type c_double = f64;
88+
pub type c_longlong = i64;
89+
pub type c_ulonglong = u64;
90+
pub type intmax_t = i64;
91+
pub type uintmax_t = u64;
92+
93+
pub type size_t = usize;
94+
pub type ptrdiff_t = isize;
95+
pub type intptr_t = isize;
96+
pub type uintptr_t = usize;
97+
pub type ssize_t = isize;
98+
8099
pub enum FILE {}
81100
pub enum fpos_t {}
82101
pub enum DIR {}

src/unix/bsd/apple/b32.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
33
pub type c_long = i32;
44
pub type c_ulong = u32;
5-
pub type size_t = u32;
6-
pub type ptrdiff_t = i32;
7-
pub type intptr_t = i32;
8-
pub type uintptr_t = u32;
95

106
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
117
pub const __PTHREAD_COND_SIZE__: usize = 24;

src/unix/bsd/apple/b64.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
33
pub type c_long = i64;
44
pub type c_ulong = u64;
5-
pub type size_t = u64;
6-
pub type ptrdiff_t = i64;
7-
pub type intptr_t = i64;
8-
pub type uintptr_t = u64;
95

106
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
117
pub const __PTHREAD_COND_SIZE__: usize = 40;

src/unix/bsd/apple/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub type suseconds_t = i32;
88
pub type dev_t = i32;
99
pub type ino_t = u64;
1010
pub type mode_t = u16;
11-
pub type ssize_t = c_long;
1211
pub type nlink_t = u16;
1312
pub type blksize_t = i32;
1413
pub type rlim_t = u64;
@@ -20,9 +19,9 @@ pub enum timezone {}
2019

2120
s! {
2221
pub struct glob_t {
23-
pub gl_pathc: size_t,
22+
pub gl_pathc: ::size_t,
2423
__unused1: ::c_int,
25-
pub gl_offs: size_t,
24+
pub gl_offs: ::size_t,
2625
__unused2: ::c_int,
2726
pub gl_pathv: *mut *mut ::c_char,
2827

@@ -390,7 +389,7 @@ pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
390389

391390
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
392391
pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
393-
pub const PTHREAD_STACK_MIN: size_t = 8192;
392+
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
394393

395394
pub const RLIMIT_CPU: ::c_int = 0;
396395
pub const RLIMIT_FSIZE: ::c_int = 1;

src/unix/bsd/freebsdlike/x86.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
pub type c_long = i32;
22
pub type c_ulong = u32;
3-
pub type size_t = u32;
4-
pub type ptrdiff_t = i32;
53
pub type time_t = i32;
64
pub type suseconds_t = i32;
7-
pub type intptr_t = i32;
8-
pub type uintptr_t = u32;
9-
pub type ssize_t = i32;
105

116
s! {
127
pub struct stat {

src/unix/bsd/freebsdlike/x86_64.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
pub type c_long = i64;
22
pub type c_ulong = u64;
3-
pub type size_t = u64;
4-
pub type ptrdiff_t = i64;
53
pub type time_t = i64;
64
pub type suseconds_t = i64;
7-
pub type intptr_t = i64;
8-
pub type uintptr_t = u64;
9-
pub type ssize_t = i64;
105

116
s! {
127
pub struct stat {

src/unix/bsd/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub type useconds_t = u32;
55
pub type blkcnt_t = i64;
66
pub type socklen_t = u32;
77
pub type sa_family_t = u8;
8-
pub type pthread_t = uintptr_t;
8+
pub type pthread_t = ::uintptr_t;
99

1010
s! {
1111
pub struct sockaddr {
@@ -76,11 +76,11 @@ pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
7676
pub const IPV6_V6ONLY: ::c_int = 27;
7777

7878
extern {
79-
pub fn mincore(addr: *const ::c_void, len: size_t,
79+
pub fn mincore(addr: *const ::c_void, len: ::size_t,
8080
vec: *mut c_char) -> ::c_int;
8181
pub fn sysctlnametomib(name: *const c_char,
8282
mibp: *mut ::c_int,
83-
sizep: *mut size_t)
83+
sizep: *mut ::size_t)
8484
-> ::c_int;
8585
pub fn setgroups(ngroups: ::c_int,
8686
ptr: *const ::gid_t) -> ::c_int;

src/unix/bsd/openbsdlike/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
pub type c_long = i64;
22
pub type c_ulong = u64;
3-
pub type size_t = u64;
4-
pub type ptrdiff_t = i64;
53
pub type clock_t = i64;
64
pub type time_t = i64;
75
pub type suseconds_t = i64;
8-
pub type intptr_t = i64;
9-
pub type uintptr_t = u64;
106
pub type dev_t = i32;
117
pub type mode_t = u32;
12-
pub type ssize_t = c_long;
138
pub type nlink_t = uint32_t;
149
pub type blksize_t = uint32_t;
1510
pub type ino_t = uint64_t;

0 commit comments

Comments
 (0)