Skip to content

Commit

Permalink
Merge pull request rust-lang#4 from japaric/long
Browse files Browse the repository at this point in the history
change c_{,u}long to match libc v0.2.23 definitions
  • Loading branch information
japaric authored May 29, 2017
2 parents 4a17eaa + 02aa724 commit 6bf55c1
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

// AD = Architecture dependent
pub use ad::*;
// OD = OS dependent
pub use od::*;
// PWD = Pointer Width Dependent
pub use pwd::*;

Expand All @@ -30,20 +32,47 @@ mod ad {
pub type c_char = ::c_schar;
}

// NOTE c_{,u}long definitions come from libc v0.2.3
#[cfg(not(any(windows,
target_os = "redox",
target_os = "solaris")))]
mod od {
#[cfg(target_pointer_width = "32")]
pub type c_long = i32;
#[cfg(target_pointer_width = "32")]
pub type c_ulong = u32;

#[cfg(target_pointer_width = "64")]
pub type c_long = i64;
#[cfg(target_pointer_width = "64")]
pub type c_ulong = u64;
}

#[cfg(windows)]
mod od {
pub type c_long = i32;
pub type c_ulong = u32;
}

#[cfg(any(target_os = "redox",
target_os = "solaris"))]
mod od {
pub type c_long = i64;
pub type c_ulong = u64;
}

#[cfg(target_pointer_width = "32")]
mod pwd {}

#[cfg(target_pointer_width = "64")]
mod pwd {}

pub type c_int = i32;
pub type c_long = i32;
pub type c_longlong = i64;
pub type c_schar = i8;
pub type c_short = i16;
pub type c_uchar = u8;
pub type c_uint = u32;
pub type c_ulong = u32;
pub type c_ulonglong = u64;
pub type c_ushort = u16;

Expand Down

0 comments on commit 6bf55c1

Please sign in to comment.