Skip to content

Commit 7cd359e

Browse files
committed
Fix a few ci/style.rs issues.
1 parent bfa55d3 commit 7cd359e

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/zephyr/mod.rs

+19-17
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,28 @@ pub type uint16_t = u16;
1212
pub type uint32_t = u32;
1313
pub 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+
}
1922
pub type c_schar = i8;
2023
pub type c_uchar = u8;
2124
pub type c_short = i16;
2225
pub type c_ushort = u16;
2326
pub type c_int = i32;
2427
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+
}
3337
pub type c_longlong = i64;
3438
pub type c_ulonglong = u64;
3539
pub 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

Comments
 (0)