Skip to content

Commit

Permalink
esp-wifi: other crates also provide strchr (littlefs2-sys) (#2096)
Browse files Browse the repository at this point in the history
* esp-wifi: other crates also provide strchr (littlefs2-sys)

* esp-wifi: other crates also provide strchr (littlefs2-sys)

* changelog

* fmt :-(
  • Loading branch information
liebman authored Sep 6, 2024
1 parent 17daa46 commit 492e35a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions esp-wifi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions esp-wifi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
6 changes: 6 additions & 0 deletions esp-wifi/src/compat/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 492e35a

Please sign in to comment.