diff --git a/esp-wifi/CHANGELOG.md b/esp-wifi/CHANGELOG.md index f57e350d5..9db54114a 100644 --- a/esp-wifi/CHANGELOG.md +++ b/esp-wifi/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added `have-strchr` feature to disable including `strchr` (#2096) + ### Changed ### Fixed diff --git a/esp-wifi/Cargo.toml b/esp-wifi/Cargo.toml index 41f9968d0..6165c12c6 100644 --- a/esp-wifi/Cargo.toml +++ b/esp-wifi/Cargo.toml @@ -133,6 +133,7 @@ wifi-default = ["ipv4", "tcp", "udp", "icmp", "igmp", "dns", "dhcpv4"] defmt = ["dep:defmt", "smoltcp?/defmt", "esp-hal/defmt"] log = ["dep:log", "esp-hal/log"] sniffer = ["wifi"] +have-strchr = [] [package.metadata.docs.rs] features = [ diff --git a/esp-wifi/src/compat/misc.rs b/esp-wifi/src/compat/misc.rs index 1ac65abec..d0b44af3b 100644 --- a/esp-wifi/src/compat/misc.rs +++ b/esp-wifi/src/compat/misc.rs @@ -46,6 +46,12 @@ unsafe extern "C" fn strcmp(str1: *const i8, str2: *const i8) -> i32 { } } +#[cfg(feature = "have-strchr")] +extern "C" { + fn strchr(str: *const i8, c: i32) -> *const i8; +} + +#[cfg(not(feature = "have-strchr"))] #[no_mangle] unsafe extern "C" fn strchr(str: *const i8, c: i32) -> *const i8 { trace!("strchr {:?} {}", str, c);