@@ -12,24 +12,28 @@ pub type uint16_t = u16;
12
12
pub type uint32_t = u32 ;
13
13
pub type uint64_t = u64 ;
14
14
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
+ }
19
22
pub type c_schar = i8 ;
20
23
pub type c_uchar = u8 ;
21
24
pub type c_short = i16 ;
22
25
pub type c_ushort = u16 ;
23
26
pub type c_int = i32 ;
24
27
pub 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
+ }
33
37
pub type c_longlong = i64 ;
34
38
pub type c_ulonglong = u64 ;
35
39
pub type intmax_t = i64 ;
@@ -63,14 +67,12 @@ cfg_if! {
63
67
}
64
68
}
65
69
66
- extern {
70
+ extern "C" {
67
71
pub fn strlen ( cs : * const c_char ) -> size_t ;
68
72
69
73
pub fn memchr ( cx : * const c_void , c : c_int , n : size_t ) -> * mut c_void ;
70
74
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 ;
75
77
pub fn memset ( dest : * mut c_void , c : c_int , n : size_t ) -> * mut c_void ;
76
78
}
0 commit comments