Skip to content

Commit 062b9dc

Browse files
authored
Merge pull request #539 from kornelski/cf-zlib
Drop cloudflare-zlib feature support
2 parents ef4eeaa + c2706cc commit 062b9dc

4 files changed

Lines changed: 7 additions & 60 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ libz-sys = { version = "1.1.20", optional = true, default-features = false }
2323
libz-ng-sys = { version = "1.1.16", optional = true }
2424
# this matches the default features, but we don't want to depend on the default features staying the same
2525
zlib-rs = { version = "0.6.0", optional = true, default-features = false, features = ["std", "rust-allocator"] }
26-
cloudflare-zlib-sys = { version = "0.3.6", optional = true }
2726
## This implementation uses only safe Rust code and doesn't require a C compiler.
2827
## It provides good performance for most use cases while being completely portable.
2928
miniz_oxide = { version = "0.8.5", optional = true, default-features = false, features = ["with-alloc", "simd"] }
@@ -46,7 +45,7 @@ default = ["rust_backend"]
4645
#! ### User-Facing Backend Features
4746
#! Choose one of these features to select the compression backend.
4847
#! Only one backend should be enabled at a time, or else one will see an unstable order which is currently
49-
#! `zlib-ng`, `zlib-rs`, `cloudflare_zlib`, `miniz_oxide` and which may change at any time.
48+
#! `zlib-ng`, `zlib-rs`, `miniz_oxide` and which may change at any time.
5049

5150
## Use the pure Rust `miniz_oxide` backend (default).
5251
## This implementation uses only safe Rust code and doesn't require a C compiler.
@@ -88,11 +87,9 @@ zlib-ng-compat = ["zlib", "libz-sys/zlib-ng", "dep:crc32fast"]
8887
## other dependencies use zlib. Requires a C compiler.
8988
zlib-ng = ["any_c_zlib", "libz-ng-sys", "dep:crc32fast"]
9089

91-
## Use Cloudflare's optimized zlib implementation.
92-
## This provides better performance than stock zlib on x86-64 (with SSE 4.2) and ARM64 (with NEON & CRC).
93-
## * ⚠ Does not support 32-bit CPUs and is incompatible with mingw.
94-
## * ⚠ May cause conflicts if other crates use different zlib versions.
95-
cloudflare_zlib = ["any_c_zlib", "cloudflare-zlib-sys", "dep:crc32fast"]
90+
## Cloudflare-zlib is no longer supported.
91+
## Falls back to `libz-sys`, but we recommend switching to `zlib-rs` instead.
92+
cloudflare_zlib = ["zlib"]
9693

9794
## Deprecated alias for `rust_backend`, provided for backwards compatibility.
9895
## Use `rust_backend` instead.
@@ -103,12 +100,12 @@ miniz-sys = ["rust_backend"]
103100
#! They are documented here to aid with maintenance.
104101

105102
## **Internal:** Marker feature indicating that any zlib-based C backend is enabled.
106-
## This is automatically enabled by `zlib-rs`, `zlib`, `zlib-ng`, `zlib-ng-compat`, and `cloudflare_zlib`.
103+
## This is automatically enabled by `zlib-rs`, `zlib`, `zlib-ng`, and `zlib-ng-compat`.
107104
## Do not enable this feature directly; instead, choose a specific backend feature.
108105
any_zlib = ["any_impl"]
109106

110107
## **Internal:** Marker feature indicating that any C based fully zlib compatible backend is enabled.
111-
## This is automatically enabled by `zlib`, `zlib-ng`, `zlib-ng-compat`, and `cloudflare_zlib`.
108+
## This is automatically enabled by `zlib`, `zlib-ng`, and `zlib-ng-compat`.
112109
## Do not enable this feature directly; instead, choose a specific backend feature.
113110
any_c_zlib = ["any_zlib"]
114111

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,6 @@ See [the libz-sys
114114
README](https://github.com/rust-lang/libz-sys/blob/main/README.md) for details.
115115
To avoid that, use the `"zlib-ng"` feature instead.
116116

117-
For compatibility with previous versions of `flate2`, the Cloudflare optimized
118-
version of zlib is available, via the `cloudflare_zlib` feature. It's not as
119-
fast as zlib-ng, but it's faster than stock zlib. It requires an x86-64 CPU with
120-
SSE 4.2 or ARM64 with NEON & CRC. It does not support 32-bit CPUs at all and is
121-
incompatible with mingw. For more information check the [crate
122-
documentation](https://crates.io/crates/cloudflare-zlib-sys). Note that
123-
`cloudflare_zlib` will cause breakage if any other crate in your crate graph
124-
uses another version of zlib/libz.
125-
126117
# License
127118

128119
This project is licensed under either of

src/ffi/c.rs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,8 @@ impl Default for StreamWrapper {
5151
opaque: ptr::null_mut(),
5252
state: ptr::null_mut(),
5353

54-
#[cfg(any(
55-
// zlib-ng
56-
feature = "zlib-ng",
57-
// libz-sys
58-
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng"))
59-
))]
6054
zalloc: allocator::zalloc,
61-
#[cfg(any(
62-
// zlib-ng
63-
feature = "zlib-ng",
64-
// libz-sys
65-
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng"))
66-
))]
6755
zfree: allocator::zfree,
68-
69-
#[cfg(
70-
// cloudflare-zlib
71-
all(feature = "cloudflare_zlib", not(feature = "zlib-ng")),
72-
)]
73-
zalloc: Some(allocator::zalloc),
74-
#[cfg(
75-
// cloudflare-zlib
76-
all(feature = "cloudflare_zlib", not(feature = "zlib-ng")),
77-
)]
78-
zfree: Some(allocator::zfree),
7956
})),
8057
}
8158
}
@@ -91,14 +68,6 @@ impl Drop for StreamWrapper {
9168
}
9269
}
9370

94-
#[cfg(any(
95-
// zlib-ng
96-
feature = "zlib-ng",
97-
// cloudflare-zlib
98-
all(feature = "cloudflare_zlib", not(feature = "zlib-ng")),
99-
// libz-sys
100-
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng")),
101-
))]
10271
mod allocator {
10372
use super::*;
10473

@@ -455,16 +424,7 @@ mod c_backend {
455424
#[cfg(feature = "zlib-ng")]
456425
use libz_ng_sys as libz;
457426

458-
#[cfg(
459-
// cloudflare-zlib
460-
all(feature = "cloudflare_zlib", not(feature = "zlib-ng")),
461-
)]
462-
use cloudflare_zlib_sys as libz;
463-
464-
#[cfg(
465-
// libz-sys
466-
all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng")),
467-
)]
427+
#[cfg(not(feature = "zlib-ng"))]
468428
use libz_sys as libz;
469429

470430
pub use libz::deflate as mz_deflate;

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
//!
4848
//! * zlib-ng
4949
//! * zlib-rs
50-
//! * cloudflare_zlib
5150
//! * miniz_oxide
5251
//!
5352
//! # Organization

0 commit comments

Comments
 (0)