bearssl-sys: use bindgen's usize setting

* `bindgen` can now set size_t as usize. This should remove the annoying
  type definition.
main
Aydin Mercan 2022-11-05 16:12:38 +03:00
parent 8d5a9f7a16
commit 771f543cb5
Signed by: jaiden
SSH Key Fingerprint: SHA256:vy6hjzotbn/MWZAbjzURNk3NL62EPkjoHsJ5xr/s7nk
3 changed files with 3 additions and 9 deletions

View File

@ -11,12 +11,6 @@ Currently BearSSL 0.6 and latest Rust stable is supported.
* `bundled`: Build and link statically BearSSL. Needs a working C compiler and autoenables some sensible flags for the build target.
* `dont-assume-size_t-equals-uintptr_t`: Use libc's `size_t` instead of `usize`. Should only needed when `sizeof(uintptr_t) != sizeof(size_t)`.
## Misc.
Once `core::ffi` types are stable, the bindings can and should be
dependency-free for platforms where `dont-assume-size_t-equals-uintptr_t`
isn't required.
## License
This repository is licensed under the BSD-3-Clause. Please refer to `LICENSE` and

View File

@ -5,6 +5,8 @@ use std::path::PathBuf;
fn main() {
linkage::configure();
let usize_equals_size_t = !cfg!(feature = "dont-assume-size_t-equals-uintptr_t");
let bindings = bindgen::builder()
.use_core()
.ctypes_prefix("::core::ffi")
@ -17,6 +19,7 @@ fn main() {
.blocklist_type("__.*_t")
.blocklist_type("size_t")
.generate_comments(false)
.size_t_is_usize(usize_equals_size_t)
.generate()
.expect("Unable to generate bindings");

View File

@ -15,7 +15,4 @@
#[cfg(feature = "dont-assume-size_t-equals-uintptr_t")]
use libc::size_t;
#[cfg(not(feature = "dont-assume-size_t-equals-uintptr_t"))]
type size_t = usize;
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));