mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-12 13:28:49 +00:00
fix(c-api) Allow finalizer to be NULL.
This commit is contained in:
@@ -7,6 +7,7 @@ use std::ffi::c_void;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wasmer::{Function, Instance, RuntimeError, Val};
|
use wasmer::{Function, Instance, RuntimeError, Val};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct wasm_func_t {
|
pub struct wasm_func_t {
|
||||||
pub(crate) inner: Function,
|
pub(crate) inner: Function,
|
||||||
@@ -91,12 +92,11 @@ pub unsafe extern "C" fn wasm_func_new_with_env(
|
|||||||
function_type: Option<&wasm_functype_t>,
|
function_type: Option<&wasm_functype_t>,
|
||||||
callback: Option<wasm_func_callback_with_env_t>,
|
callback: Option<wasm_func_callback_with_env_t>,
|
||||||
env: *mut c_void,
|
env: *mut c_void,
|
||||||
finalizer: Option<wasm_env_finalizer_t>,
|
finalizer: wasm_env_finalizer_t,
|
||||||
) -> Option<Box<wasm_func_t>> {
|
) -> Option<Box<wasm_func_t>> {
|
||||||
let store = store?;
|
let store = store?;
|
||||||
let function_type = function_type?;
|
let function_type = function_type?;
|
||||||
let callback = callback?;
|
let callback = callback?;
|
||||||
let finalizer = finalizer?;
|
|
||||||
|
|
||||||
let func_sig = &function_type.inner().function_type;
|
let func_sig = &function_type.inner().function_type;
|
||||||
let num_rets = func_sig.results().len();
|
let num_rets = func_sig.results().len();
|
||||||
|
|||||||
Reference in New Issue
Block a user