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

fix(runtime-c-api) wasmer_instance_call types must matche wasmer_export_func_*_arity #440

Merged

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented May 14, 2019

The wasmer_export_func_params_arity and
wasmer_export_func_returns_arity functions store the arity in a
uint32_t. The wasmer_instance_call expects c_int. There is a
type mismatch here. It's not annoying in C or C++, but in some other
languages that have bindings to C/C++, it can imply useless casting.

This patch changes wasmer_instance_call to expect uint32_t for
params_len and results_len to match the
wasmer_export_func_*_arity functions.

Other patches do the same for wasmer_export_func_params and
wasmer_export_func_returns.

Hywan added 3 commits May 14, 2019 11:46
…t_func_*_arity`.

The `wasmer_export_func_params_arity` and
`wasmer_export_func_returns_arity` functions store the arity in a
`uint32_t`. The `wasmer_instance_call` expects `c_int`. There is a
type mismatch here. It's not annoying in C or C++, but in some other
languages that have bindings to C/C++, it can imply useless casting.

This patch changes `wasmer_instance_call` to expect `uint32_t` for
`params_len` and `results_len` to match the
`wasmer_export_func_*_arity` functions.
@Hywan Hywan added bug Something isn't working 📦 lib-c-api About wasmer-c-api 🧪 tests I love tests labels May 14, 2019
@Hywan
Copy link
Contributor Author

Hywan commented May 14, 2019

bors try

bors bot added a commit that referenced this pull request May 14, 2019
@Hywan Hywan changed the title fix(runtime-c-api) wasmer_instance_call types matches wasmer_export_func_*_arity fix(runtime-c-api) wasmer_instance_call types must matches wasmer_export_func_*_arity May 14, 2019
@Hywan Hywan changed the title fix(runtime-c-api) wasmer_instance_call types must matches wasmer_export_func_*_arity fix(runtime-c-api) wasmer_instance_call types must matche wasmer_export_func_*_arity May 14, 2019
@bors
Copy link
Contributor

bors bot commented May 14, 2019

Hywan added 4 commits May 14, 2019 16:15
The `params_len` argument type of `wasmer_export_func_params_arity`
must be `uint32_t` to match the `wasmer_export_func_*_arity` results,
so that casts are not required.
The `returns_len` argument type of `wasmer_export_func_returns_params`
must be `uint32_t` to match the `wasmer_export_func_returns_arity` results,
so that casts are not required.
@Hywan
Copy link
Contributor Author

Hywan commented May 14, 2019

bors try

bors bot added a commit that referenced this pull request May 14, 2019
@bors
Copy link
Contributor

bors bot commented May 14, 2019

@Hywan
Copy link
Contributor Author

Hywan commented May 14, 2019

bors r+

bors bot added a commit that referenced this pull request May 14, 2019
440: fix(runtime-c-api) `wasmer_instance_call` types must matche `wasmer_export_func_*_arity` r=Hywan a=Hywan

The `wasmer_export_func_params_arity` and
`wasmer_export_func_returns_arity` functions store the arity in a
`uint32_t`. The `wasmer_instance_call` expects `c_int`. There is a
type mismatch here. It's not annoying in C or C++, but in some other
languages that have bindings to C/C++, it can imply useless casting.

This patch changes `wasmer_instance_call` to expect `uint32_t` for
`params_len` and `results_len` to match the
`wasmer_export_func_*_arity` functions.

Other patches do the same for `wasmer_export_func_params` and
`wasmer_export_func_returns`.

Co-authored-by: Ivan Enderlin <[email protected]>
@bors
Copy link
Contributor

bors bot commented May 14, 2019

@bors bors bot merged commit 8bd9bbb into wasmerio:master May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📦 lib-c-api About wasmer-c-api 🧪 tests I love tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants