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

Feat: improve input loading and string handling #16

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Conversation

G4Vi
Copy link
Contributor

@G4Vi G4Vi commented Dec 15, 2023

Resolves #14

  • namespace import macros
  • take void * pointers to be more flexible
  • improve input loading
    • check against extism_input_length and return false if too many bytes are requested
    • add convenience functions to load into zero terminated strings
    • add convenience functions to load input data into a malloc'd buffer (strdup-esque), requires #define EXTISM_USE_LIBC
  • add convenience function to copy the contents of a zero terminated string into Extism memory. If EXTISM_USE_LIBC is not defined, it uses it's own strlen implementation.

G4Vi added 4 commits December 14, 2023 14:09
* take `void *` instead of `uint8_t*` for buffer params
* add `const` to imports to signify when a ExtismPointer's data is modified
* pass void to imports that shouldn't take parameters
* minor cleanup in store and load functions
* use size_t for pdk offsets and sizes instead of hardcoding it to uint64_t.
  * in wasm32 its 4 bytes
  * in wasm64 its 8 bytes
* deprecate extism_alloc_string / add extism_alloc_buf
…input, rename parameters to be more like libc
@G4Vi G4Vi requested a review from zshipko December 15, 2023 17:57
Copy link
Contributor

@zshipko zshipko left a comment

Choose a reason for hiding this comment

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

This is a big improvement, thanks!

@G4Vi G4Vi merged commit 5add50e into main Dec 15, 2023
2 checks passed
@G4Vi G4Vi deleted the feat-improve-pdk branch December 15, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

header improvements
2 participants