c-api: refactor definitions with macroes (#4416)

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
This commit is contained in:
罗泽轩
2022-07-11 22:10:41 +08:00
committed by GitHub
parent 6c70428735
commit 1d319c0ec2
5 changed files with 10 additions and 54 deletions

View File

@@ -12,6 +12,8 @@ pub struct wasmtime_linker_t {
linker: Linker<crate::StoreData>,
}
wasmtime_c_api_macros::declare_own!(wasmtime_linker_t);
#[no_mangle]
pub extern "C" fn wasmtime_linker_new(engine: &wasm_engine_t) -> Box<wasmtime_linker_t> {
Box::new(wasmtime_linker_t {
@@ -27,9 +29,6 @@ pub extern "C" fn wasmtime_linker_allow_shadowing(
linker.linker.allow_shadowing(allow_shadowing);
}
#[no_mangle]
pub extern "C" fn wasmtime_linker_delete(_linker: Box<wasmtime_linker_t>) {}
macro_rules! to_str {
($ptr:expr, $len:expr) => {
match str::from_utf8(crate::slice_from_raw_parts($ptr, $len)) {