Skip to content

Commit 8d1467d

Browse files
committed
Fix cfgs
1 parent 14aec22 commit 8d1467d

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

src/ffi/c.rs

+38-18
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,38 @@ impl Default for StreamWrapper {
5050
reserved: 0,
5151
opaque: ptr::null_mut(),
5252
state: ptr::null_mut(),
53-
#[cfg(all(
54-
feature = "any_zlib",
55-
not(any(feature = "cloudflare-zlib-sys", feature = "libz-rs-sys"))
53+
54+
#[cfg(any(
55+
// zlib-ng
56+
feature = "zlib-ng",
57+
// libz-sys
58+
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng"), not(feature = "zlib-rs"))
5659
))]
5760
zalloc: allocator::zalloc,
58-
#[cfg(all(
59-
feature = "any_zlib",
60-
not(any(feature = "cloudflare-zlib-sys", feature = "libz-rs-sys"))
61+
#[cfg(any(
62+
// zlib-ng
63+
feature = "zlib-ng",
64+
// libz-sys
65+
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng"), not(feature = "zlib-rs"))
6166
))]
6267
zfree: allocator::zfree,
6368

64-
#[cfg(all(feature = "any_zlib", feature = "cloudflare-zlib-sys"))]
69+
#[cfg(
70+
// cloudflare-zlib
71+
all(feature = "cloudflare_zlib", not(feature = "zlib-rs"), not(feature = "zlib-ng")),
72+
)]
6573
zalloc: Some(allocator::zalloc),
66-
#[cfg(all(feature = "any_zlib", feature = "cloudflare-zlib-sys"))]
74+
#[cfg(
75+
// cloudflare-zlib
76+
all(feature = "cloudflare_zlib", not(feature = "zlib-rs"), not(feature = "zlib-ng")),
77+
)]
6778
zfree: Some(allocator::zfree),
6879

6980
// for zlib-rs, it is most efficient to have it provide the allocator.
7081
// The libz-rs-sys dependency is configured to use the rust system allocator
71-
#[cfg(all(feature = "any_zlib", feature = "libz-rs-sys"))]
82+
#[cfg(all(feature = "zlib-rs", not(feature = "zlib-ng")))]
7283
zalloc: None,
73-
#[cfg(all(feature = "any_zlib", feature = "libz-rs-sys"))]
84+
#[cfg(all(feature = "zlib-rs", not(feature = "zlib-ng")))]
7485
zfree: None,
7586
})),
7687
}
@@ -87,7 +98,14 @@ impl Drop for StreamWrapper {
8798
}
8899
}
89100

90-
#[cfg(all(feature = "any_zlib", not(feature = "libz-rs-sys")))]
101+
#[cfg(any(
102+
// zlib-ng
103+
feature = "zlib-ng",
104+
// cloudflare-zlib
105+
all(feature = "cloudflare_zlib", not(feature = "zlib-rs"), not(feature = "zlib-ng")),
106+
// libz-sys
107+
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng"), not(feature = "zlib-rs")),
108+
))]
91109
mod allocator {
92110
use super::*;
93111

@@ -405,17 +423,19 @@ mod c_backend {
405423
#[cfg(feature = "zlib-ng")]
406424
use libz_ng_sys as libz;
407425

408-
#[cfg(all(not(feature = "zlib-ng"), feature = "zlib-rs"))]
426+
#[cfg(all(feature = "zlib-rs", not(feature = "zlib-ng")))]
409427
use libz_rs_sys as libz;
410428

411-
#[cfg(all(not(feature = "zlib-ng"), feature = "cloudflare_zlib"))]
429+
#[cfg(
430+
// cloudflare-zlib
431+
all(feature = "cloudflare_zlib", not(feature = "zlib-rs"), not(feature = "zlib-ng")),
432+
)]
412433
use cloudflare_zlib_sys as libz;
413434

414-
#[cfg(all(
415-
not(feature = "cloudflare_zlib"),
416-
not(feature = "zlib-ng"),
417-
not(feature = "zlib-rs")
418-
))]
435+
#[cfg(
436+
// libz-sys
437+
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng"), not(feature = "zlib-rs")),
438+
)]
419439
use libz_sys as libz;
420440

421441
pub use libz::deflate as mz_deflate;

0 commit comments

Comments
 (0)