memorysafety / zlib-rs

A safer zlib
zlib License
91 stars 6 forks source link

remove libc dependency #19

Closed folkertdev closed 6 days ago

folkertdev commented 6 months ago

we don't think we need it in practice

FreezyLemon commented 4 months ago

What about z_off_t?

https://github.com/memorysafety/zlib-rs/blob/1e9b165b422b01d8b8b7dd41e96f9b1ddcfe41e0/libz-rs-sys/src/lib.rs#L64-L68

off_t is technically in std, but it's deprecated (and libc explicitly mentioned as an alternative).

folkertdev commented 4 months ago

yes, this type is extremely annoying. The zlib-rs crate has zero dependencies now for a release build, and libz-rs-sys effectively only relies on this type. We could "inline" this type but it changes radically between targets.

folkertdev commented 6 days ago

we've ditched libc a while ago. We provide this definition

// In spirit this type is `libc::off_t`, but it would be our only libc dependency, and so we
// hardcode the type here. This should be correct on most operating systems. If we ever run into
// issues with it, we can either special-case or add a feature flag to force a particular width
pub type z_off_t = c_long;

so far that feature flag has not been needed.