Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use own implementation instead of ROM functions, re-add memchr #2896

Merged
merged 4 commits into from
Jan 8, 2025

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Jan 6, 2025

…nction

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • I have added necessary changes to user code to the Migration Guide.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

skip-changelog b.c. of the changes in esp-hal

Testing

WPA2-ENTERPRISE example (have it locally - can provide if needed)

@bjoernQ bjoernQ added the skip-changelog No changelog modification needed label Jan 6, 2025
@bjoernQ bjoernQ marked this pull request as ready for review January 6, 2025 14:33
@bjoernQ bjoernQ changed the title Use own implementation instead of ROM functions, re-add memchr ROM fu… Use own implementation instead of ROM functions, re-add memchr Jan 6, 2025

// We cannot just use the ROM function since it calls `__getreent`
//
// From docs: The __getreent() function returns a per-task pointer to struct
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking into why on earth atoi needed to be reentrant, it seems it can set errno and therefore needs a thread local errno to set to avoid race conditions - annoying.


unsafe {
let s = core::ffi::CStr::from_ptr(str);
let s = s.to_str().unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use count_bytes here instead? It'd be ideal not to assume UTF-8 here by calling to_str()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - not only are C strings not necessarily UTF8, the validation done by to_str is annoyingly expensive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - I just re-surrected this from an old commit without looking at it

Copy link
Collaborator

@Dominaezzz Dominaezzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't confirm the magic numbers in the *.ld files but the rest LGTM

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jessebraham jessebraham added this pull request to the merge queue Jan 8, 2025
Merged via the queue into esp-rs:main with commit 6b4312f Jan 8, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants