diff --git a/lib/c-api/src/wasm_c_api/types/export.rs b/lib/c-api/src/wasm_c_api/types/export.rs index 9c70d0473..205566d5e 100644 --- a/lib/c-api/src/wasm_c_api/types/export.rs +++ b/lib/c-api/src/wasm_c_api/types/export.rs @@ -42,12 +42,9 @@ impl From for wasm_exporttype_t { impl From<&ExportType> for wasm_exporttype_t { fn from(other: &ExportType) -> Self { - let name = other.name().to_string().into(); + let name = Box::new(other.name().to_string().into()); let extern_type = Box::new(other.ty().into()); - wasm_exporttype_t { - name: Box::new(name), - extern_type, - } + wasm_exporttype_t { name, extern_type } } } diff --git a/lib/c-api/src/wasm_c_api/types/import.rs b/lib/c-api/src/wasm_c_api/types/import.rs index a8b215836..13a56c46d 100644 --- a/lib/c-api/src/wasm_c_api/types/import.rs +++ b/lib/c-api/src/wasm_c_api/types/import.rs @@ -50,13 +50,13 @@ impl From for wasm_importtype_t { impl From<&ImportType> for wasm_importtype_t { fn from(other: &ImportType) -> Self { - let module = other.module().to_string().into(); - let name = other.name().to_string().into(); + let module = Box::new(other.module().to_string().into()); + let name = Box::new(other.name().to_string().into()); let extern_type = Box::new(other.ty().into()); wasm_importtype_t { - module: Box::new(module), - name: Box::new(name), + module, + name, extern_type, } } diff --git a/lib/c-api/src/wasm_c_api/types/mod.rs b/lib/c-api/src/wasm_c_api/types/mod.rs index 5f692b7c8..c022ba17e 100644 --- a/lib/c-api/src/wasm_c_api/types/mod.rs +++ b/lib/c-api/src/wasm_c_api/types/mod.rs @@ -33,11 +33,11 @@ impl From for wasm_name_t { let mut boxed_str: Box = string.into_boxed_str(); let data = boxed_str.as_mut_ptr(); let size = boxed_str.bytes().len(); - let wasm_byte = Self { data, size }; + let wasm_name = Self { data, size }; Box::leak(boxed_str); - wasm_byte + wasm_name } } diff --git a/lib/c-api/src/wasm_c_api/wasi/mod.rs b/lib/c-api/src/wasm_c_api/wasi/mod.rs index 8e286ca2d..a7d4ed1b8 100644 --- a/lib/c-api/src/wasm_c_api/wasi/mod.rs +++ b/lib/c-api/src/wasm_c_api/wasi/mod.rs @@ -411,13 +411,13 @@ unsafe fn wasi_get_unordered_imports_inner( *imports = import_object .into_iter() .map(|((module, name), export)| { - let module = module.into(); - let name = name.into(); + let module = Box::new(module.into()); + let name = Box::new(name.into()); let extern_inner = Extern::from_vm_export(store, export); Box::new(wasm_named_extern_t { - module: Box::new(module), - name: Box::new(name), + module, + name, r#extern: Box::new(wasm_extern_t { instance: None, inner: extern_inner,