@@ -12,24 +12,28 @@ pub type uint16_t = u16;
1212pub type uint32_t = u32 ;
1313pub type uint64_t = u64 ;
1414
15- #[ cfg( target_arch = "aarch64" ) ]
16- pub type c_char = u8 ;
17- #[ cfg( not( target_arch = "aarch64" ) ) ]
18- pub type c_char = i8 ;
15+ cfg_if:: cfg_if! {
16+ if #[ cfg( target_arch = "aarch64" ) ] {
17+ pub type c_char = u8 ;
18+ } else {
19+ pub type c_char = i8 ;
20+ }
21+ }
1922pub type c_schar = i8 ;
2023pub type c_uchar = u8 ;
2124pub type c_short = i16 ;
2225pub type c_ushort = u16 ;
2326pub type c_int = i32 ;
2427pub type c_uint = u32 ;
25- #[ cfg( target_pointer_width = "32" ) ]
26- pub type c_long = i32 ;
27- #[ cfg( target_pointer_width = "32" ) ]
28- pub type c_ulong = u32 ;
29- #[ cfg( target_pointer_width = "64" ) ]
30- pub type c_long = i64 ;
31- #[ cfg( target_pointer_width = "64" ) ]
32- pub type c_ulong = u64 ;
28+ cfg_if:: cfg_if! {
29+ if #[ cfg( target_pointer_width = "32" ) ] {
30+ pub type c_long = i32 ;
31+ pub type c_ulong = u32 ;
32+ } else if #[ cfg( target_pointer_width = "64" ) ] {
33+ pub type c_long = i64 ;
34+ pub type c_ulong = u64 ;
35+ }
36+ }
3337pub type c_longlong = i64 ;
3438pub type c_ulonglong = u64 ;
3539pub type intmax_t = i64 ;
@@ -63,14 +67,12 @@ cfg_if! {
6367 }
6468}
6569
66- extern {
70+ extern "C" {
6771 pub fn strlen ( cs : * const c_char ) -> size_t ;
6872
6973 pub fn memchr ( cx : * const c_void , c : c_int , n : size_t ) -> * mut c_void ;
7074 pub fn memcmp ( cx : * const c_void , ct : * const c_void , n : size_t ) -> c_int ;
71- pub fn memcpy ( dest : * mut c_void , src : * const c_void ,
72- n : size_t ) -> * mut c_void ;
73- pub fn memmove ( dest : * mut c_void , src : * const c_void ,
74- n : size_t ) -> * mut c_void ;
75+ pub fn memcpy ( dest : * mut c_void , src : * const c_void , n : size_t ) -> * mut c_void ;
76+ pub fn memmove ( dest : * mut c_void , src : * const c_void , n : size_t ) -> * mut c_void ;
7577 pub fn memset ( dest : * mut c_void , c : c_int , n : size_t ) -> * mut c_void ;
7678}
0 commit comments