From fc60b2c73e8c8b00152a1305cd27239b50fdd267 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Wed, 11 Nov 2015 12:02:55 -0500 Subject: Prefer raw::c_char or libc::c_char and fix arm --- src/libstd/os/raw.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/libstd/os') diff --git a/src/libstd/os/raw.rs b/src/libstd/os/raw.rs index 60069cf7bc3..f5d23442562 100644 --- a/src/libstd/os/raw.rs +++ b/src/libstd/os/raw.rs @@ -12,9 +12,13 @@ #![stable(feature = "raw_os", since = "1.1.0")] -#[cfg(any(target_arch = "aarch64", target_os = "android"))] +#[cfg(all(not(target_os = "ios"), not(target_os = "macos"), + any(target_arch = "aarch64", target_arch = "arm", + target_os = "android")))] #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8; -#[cfg(not(any(target_arch = "aarch64", target_os = "android")))] +#[cfg(any(target_os = "ios", target_os = "macos", + not(any(target_arch = "aarch64", target_arch = "arm", + target_os = "android"))))] #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8; -- cgit 1.4.1-3-g733a5 From f9f734748cf3ac6bc5155afe288c0689cb57b918 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Wed, 11 Nov 2015 14:25:18 -0500 Subject: Cleaner c_char cfg logic --- src/libstd/ffi/c_str.rs | 9 ++++----- src/libstd/os/raw.rs | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/libstd/os') diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 2802ecfbb8d..42fd2321f01 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -37,11 +37,10 @@ use vec::Vec; /// /// A `CString` is created from either a byte slice or a byte vector. After /// being created, a `CString` predominately inherits all of its methods from -/// the `Deref` implementation to `[os::raw::c_char]`. Note that the underlying -/// array is represented as an array of `os::raw::c_char` as opposed to `u8`. A -/// `u8` slice can be obtained with the `as_bytes` method. Slices produced from -/// a `CString` do *not* contain the trailing nul terminator unless otherwise -/// specified. +/// the `Deref` implementation to `[c_char]`. Note that the underlying array +/// is represented as an array of `c_char` as opposed to `u8`. A `u8` slice +/// can be obtained with the `as_bytes` method. Slices produced from a `CString` +/// do *not* contain the trailing nul terminator unless otherwise specified. /// /// # Examples /// diff --git a/src/libstd/os/raw.rs b/src/libstd/os/raw.rs index f5d23442562..17d6b2605c6 100644 --- a/src/libstd/os/raw.rs +++ b/src/libstd/os/raw.rs @@ -12,13 +12,13 @@ #![stable(feature = "raw_os", since = "1.1.0")] -#[cfg(all(not(target_os = "ios"), not(target_os = "macos"), - any(target_arch = "aarch64", target_arch = "arm", - target_os = "android")))] +#[cfg(any(target_os = "android", + all(target_os = "linux", any(target_arch = "aarch64", + target_arch = "arm"))))] #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8; -#[cfg(any(target_os = "ios", target_os = "macos", - not(any(target_arch = "aarch64", target_arch = "arm", - target_os = "android"))))] +#[cfg(not(any(target_os = "android", + all(target_os = "linux", any(target_arch = "aarch64", + target_arch = "arm")))))] #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8; #[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8; -- cgit 1.4.1-3-g733a5