Replace c_void with core::ffi::c_void
This commit is contained in:
parent
26a52bc8c8
commit
bc8c713631
|
@ -1,5 +1,4 @@
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
use core::fmt;
|
|
||||||
|
|
||||||
pub type c_int = i32;
|
pub type c_int = i32;
|
||||||
pub type c_uchar = u8;
|
pub type c_uchar = u8;
|
||||||
|
@ -10,23 +9,7 @@ pub type size_t = usize;
|
||||||
/// The way we use it makes it fine either way but this type shouldn't be used outside of the library.
|
/// The way we use it makes it fine either way but this type shouldn't be used outside of the library.
|
||||||
pub type c_char = i8;
|
pub type c_char = i8;
|
||||||
|
|
||||||
/// This is an exact copy of <https://doc.rust-lang.org/core/ffi/enum.c_void.html>
|
pub use core::ffi::c_void;
|
||||||
/// It should be Equivalent to C's void type when used as a pointer.
|
|
||||||
///
|
|
||||||
/// We can replace this with `core::ffi::c_void` once we update the rustc version to >=1.30.0.
|
|
||||||
#[repr(u8)]
|
|
||||||
pub enum c_void {
|
|
||||||
#[doc(hidden)]
|
|
||||||
__variant1,
|
|
||||||
#[doc(hidden)]
|
|
||||||
__variant2,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Debug for c_void {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
f.pad("c_void")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A type that is as aligned as the biggest alignment for fundamental types in C
|
/// A type that is as aligned as the biggest alignment for fundamental types in C
|
||||||
/// since C11 that means as aligned as `max_align_t` is.
|
/// since C11 that means as aligned as `max_align_t` is.
|
||||||
|
@ -46,7 +29,7 @@ impl AlignedType {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))]
|
#[cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))]
|
||||||
pub(crate) const ALIGN_TO: usize = ::core::mem::align_of::<AlignedType>();
|
pub(crate) const ALIGN_TO: usize = core::mem::align_of::<AlignedType>();
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
Loading…
Reference in New Issue