diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c55fae80ef..f6272b50be4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## **[Unreleased]** ### Changed +- [#2478](https://github.com/wasmerio/wasmer/pull/2478) Rename `traps` input to `wasm_instance_new()` to `trap`. + - [#2427](https://github.com/wasmerio/wasmer/pull/2427) Update `loupe` to 0.1.3. ### Fixed diff --git a/lib/c-api/examples/features.c b/lib/c-api/examples/features.c index b9f01258b5e..c42215d1eb1 100644 --- a/lib/c-api/examples/features.c +++ b/lib/c-api/examples/features.c @@ -40,8 +40,8 @@ int main(int argc, const char* argv[]) { printf("Instantiating module...\n"); wasm_extern_vec_t imports = WASM_EMPTY_VEC; - wasm_trap_t* traps = NULL; - wasm_instance_t* instance = wasm_instance_new(store, module, &imports,&traps); + wasm_trap_t* trap = NULL; + wasm_instance_t* instance = wasm_instance_new(store, module, &imports,&trap); if (!instance) { printf("> Error instantiating module!\n"); @@ -67,7 +67,7 @@ int main(int argc, const char* argv[]) { wasm_val_vec_t arguments_as_array = WASM_ARRAY_VEC(arguments); wasm_val_vec_t results_as_array = WASM_ARRAY_VEC(results); - wasm_trap_t* trap = wasm_func_call(swap, &arguments_as_array, &results_as_array); + trap = wasm_func_call(swap, &arguments_as_array, &results_as_array); if (trap != NULL) { printf("> Failed to call `swap`.\n"); diff --git a/lib/c-api/src/wasm_c_api/externals/mod.rs b/lib/c-api/src/wasm_c_api/externals/mod.rs index ca1cb279762..0a701db1c78 100644 --- a/lib/c-api/src/wasm_c_api/externals/mod.rs +++ b/lib/c-api/src/wasm_c_api/externals/mod.rs @@ -275,9 +275,9 @@ mod tests { assert(module); wasm_extern_vec_t imports = WASM_EMPTY_VEC; - wasm_trap_t* traps = NULL; + wasm_trap_t* trap = NULL; - wasm_instance_t* instance = wasm_instance_new(store, module, &imports, &traps); + wasm_instance_t* instance = wasm_instance_new(store, module, &imports, &trap); assert(instance); wasm_extern_vec_t exports; diff --git a/lib/c-api/src/wasm_c_api/instance.rs b/lib/c-api/src/wasm_c_api/instance.rs index 0774c6ae43a..67b11d3e7a6 100644 --- a/lib/c-api/src/wasm_c_api/instance.rs +++ b/lib/c-api/src/wasm_c_api/instance.rs @@ -25,7 +25,7 @@ pub struct wasm_instance_t { /// 2. Runtime errors that happen when running the module `start` /// function. /// -/// Failures are stored in the `traps` argument; the program doesn't +/// The failure is stored in the `trap` argument; the program doesn't /// panic. /// /// # Notes @@ -41,7 +41,7 @@ pub unsafe extern "C" fn wasm_instance_new( _store: Option<&wasm_store_t>, module: Option<&wasm_module_t>, imports: Option<&wasm_extern_vec_t>, - traps: *mut *mut wasm_trap_t, + trap: *mut *mut wasm_trap_t, ) -> Option> { let module = module?; let imports = imports?; @@ -67,8 +67,8 @@ pub unsafe extern "C" fn wasm_instance_new( } Err(InstantiationError::Start(runtime_error)) => { - let trap: Box = Box::new(runtime_error.into()); - *traps = Box::into_raw(trap); + let this_trap: Box = Box::new(runtime_error.into()); + *trap = Box::into_raw(this_trap); return None; } @@ -124,9 +124,9 @@ pub unsafe extern "C" fn wasm_instance_delete(_instance: Option