Skip to content

Commit 0fef730

Browse files
authored
Fix definition of c_bool for non-MSVC targets (#54)
Fixes #53 Signed-off-by: Arnav Singh <[email protected]>
1 parent fd00e12 commit 0fef730

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jemalloc-sys/src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@
5050
#![deny(missing_docs, broken_intra_doc_links)]
5151

5252
use libc::{c_char, c_int, c_uint, c_void, size_t};
53+
54+
// jemalloc uses `stdbool.h` to define `bool` for which the Rust equivalent is `bool`.
55+
// However jemalloc also has its own `stdbool.h` that it uses when compiling with MSVC,
56+
// and this header defines `bool` as `BOOL` which in turn is `int`.
57+
#[cfg(target_env = "msvc")]
5358
type c_bool = c_int;
59+
#[cfg(not(target_env = "msvc"))]
60+
type c_bool = bool;
5461

5562
/// Align the memory allocation to start at an address that is a
5663
/// multiple of `1 << la`.

0 commit comments

Comments
 (0)