Skip to content

Commit aa9b59a

Browse files
committed
Code: Change mmap-rs flag to direct-mmap which disables it instead.
1 parent ccf1000 commit aa9b59a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src-rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ no_format = [] # Removes string formatting (less detailed errors) for binary siz
1919
all_private = [] # No memory mapped files, memory is not shared.
2020
size_opt = ["nightly"]
2121
nightly = [] # Optimizations for nightly builds.
22-
mmap-rs = [] # Uses mmap-rs for memory mapping. This is auto activated during build.
22+
direct-mmap = [] # If set, uses built-in code for memory mapping. This is auto activated in build.rs for supported platforms.
2323

2424
[dependencies]
2525
concat-string = "1.0.1"

src-rust/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
fn main() {
22
// This defines a fallback to mmap-rs if one of the explicit memory mapped file implementations
33
// is not available.
4-
if !cfg!(any(
4+
if cfg!(any(
55
target_os = "macos",
66
target_os = "windows",
77
target_os = "linux"
88
)) {
9-
println!("cargo:rustc-cfg=feature=\"mmap-rs\"");
9+
println!("cargo:rustc-cfg=feature=\"direct-mmap\"");
1010
}
1111
}

src-rust/src/internal/buffer_allocator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn allocate(
2222
return crate::internal::buffer_allocator_osx::allocate_osx(settings);
2323

2424
// Fallback for non-hot-path OSes.
25-
#[cfg(feature = "mmap-rs")]
25+
#[cfg(not(feature = "direct-mmap"))]
2626
crate::internal::buffer_allocator_mmap_rs::allocate_mmap_rs(settings)
2727
}
2828

src-rust/src/structs/private_allocation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl PrivateAllocation {
168168
}
169169

170170
/// Frees the allocated memory when the `PrivateAllocation` instance is dropped.
171-
#[cfg(feature = "mmap-rs")]
171+
#[cfg(not(feature = "direct-mmap"))]
172172
pub(crate) fn drop_mmap_rs(&mut self) {
173173
use mmap_rs_with_map_from_existing::MmapOptions;
174174
let _map = unsafe {
@@ -196,7 +196,7 @@ impl Drop for PrivateAllocation {
196196
return PrivateAllocation::drop_macos(self);
197197

198198
// non-hot-path-os
199-
#[cfg(feature = "mmap-rs")]
199+
#[cfg(not(feature = "direct-mmap"))]
200200
return PrivateAllocation::drop_mmap_rs(self);
201201
}
202202
}

0 commit comments

Comments
 (0)