|
7 | 7 | //! C's standard integer types may differ in width depending on
|
8 | 8 | //! the architecture, thus we need to conditionally compile those.
|
9 | 9 |
|
10 |
| -#![allow(non_camel_case_types)] |
11 |
| - |
12 |
| -#[cfg(any(target_arch = "arm", target_arch = "x86", target_arch = "riscv32",))] |
13 |
| -mod c { |
14 |
| - /// C `void` type. |
15 |
| - pub type c_void = core::ffi::c_void; |
16 |
| - |
17 |
| - /// C `char` type. |
18 |
| - pub type c_char = i8; |
19 |
| - |
20 |
| - /// C `signed char` type. |
21 |
| - pub type c_schar = i8; |
22 |
| - |
23 |
| - /// C `unsigned char` type. |
24 |
| - pub type c_uchar = u8; |
25 |
| - |
26 |
| - /// C `short` type. |
27 |
| - pub type c_short = i16; |
28 |
| - |
29 |
| - /// C `unsigned short` type. |
30 |
| - pub type c_ushort = u16; |
31 |
| - |
32 |
| - /// C `int` type. |
33 |
| - pub type c_int = i32; |
34 |
| - |
35 |
| - /// C `unsigned int` type. |
36 |
| - pub type c_uint = u32; |
37 |
| - |
38 |
| - /// C `long` type. |
39 |
| - pub type c_long = i32; |
40 |
| - |
41 |
| - /// C `unsigned long` type. |
42 |
| - pub type c_ulong = u32; |
43 |
| - |
44 |
| - /// C `long long` type. |
45 |
| - pub type c_longlong = i64; |
46 |
| - |
47 |
| - /// C `unsigned long long` type. |
48 |
| - pub type c_ulonglong = u64; |
49 |
| - |
50 |
| - /// C `ssize_t` type (typically defined in `<sys/types.h>` by POSIX). |
51 |
| - /// |
52 |
| - /// For some 32-bit architectures like this one, the kernel defines it as |
53 |
| - /// `int`, i.e. it is an [`i32`]. |
54 |
| - pub type c_ssize_t = isize; |
55 |
| - |
56 |
| - /// C `size_t` type (typically defined in `<stddef.h>`). |
57 |
| - /// |
58 |
| - /// For some 32-bit architectures like this one, the kernel defines it as |
59 |
| - /// `unsigned int`, i.e. it is an [`u32`]. |
60 |
| - pub type c_size_t = usize; |
61 |
| -} |
62 |
| - |
63 |
| -#[cfg(any( |
64 |
| - target_arch = "aarch64", |
65 |
| - target_arch = "x86_64", |
66 |
| - target_arch = "powerpc64", |
67 |
| - target_arch = "riscv64", |
68 |
| -))] |
69 |
| -mod c { |
70 |
| - /// C `void` type. |
71 |
| - pub type c_void = core::ffi::c_void; |
72 |
| - |
73 |
| - /// C `char` type. |
74 |
| - pub type c_char = i8; |
75 |
| - |
76 |
| - /// C `signed char` type. |
77 |
| - pub type c_schar = i8; |
78 |
| - |
79 |
| - /// C `unsigned char` type. |
80 |
| - pub type c_uchar = u8; |
81 |
| - |
82 |
| - /// C `short` type. |
83 |
| - pub type c_short = i16; |
84 |
| - |
85 |
| - /// C `unsigned short` type. |
86 |
| - pub type c_ushort = u16; |
87 |
| - |
88 |
| - /// C `int` type. |
89 |
| - pub type c_int = i32; |
90 |
| - |
91 |
| - /// C `unsigned int` type. |
92 |
| - pub type c_uint = u32; |
93 |
| - |
94 |
| - /// C `long` type. |
95 |
| - pub type c_long = i64; |
96 |
| - |
97 |
| - /// C `unsigned long` type. |
98 |
| - pub type c_ulong = u64; |
99 |
| - |
100 |
| - /// C `long long` type. |
101 |
| - pub type c_longlong = i64; |
102 |
| - |
103 |
| - /// C `unsigned long long` type. |
104 |
| - pub type c_ulonglong = u64; |
105 |
| - |
106 |
| - /// C `ssize_t` type (typically defined in `<sys/types.h>` by POSIX). |
107 |
| - /// |
108 |
| - /// For 64-bit architectures like this one, the kernel defines it as |
109 |
| - /// `long`, i.e. it is an [`i64`]. |
110 |
| - pub type c_ssize_t = isize; |
111 |
| - |
112 |
| - /// C `size_t` type (typically defined in `<stddef.h>`). |
113 |
| - /// |
114 |
| - /// For 64-bit architectures like this one, the kernel defines it as |
115 |
| - /// `unsigned long`, i.e. it is an [`u64`]. |
116 |
| - pub type c_size_t = usize; |
117 |
| -} |
118 |
| - |
119 |
| -pub use c::*; |
| 10 | +pub use core::ffi::*; |
0 commit comments