Sync with lucet-wasi (#106)
* Open /dev/null for writing as well as reading. Port this fix to wasi-common:b905c44483* Remove all remaining uses of `std::mem::uninitialized`. Patch inspired by:2d6519d051* Replace libc::memcpy() calls with std::ptr::copy_nonoverlapping() Port this fix to wasi-common:a3f3a33e9b* Pass `WasiError` by value. It's a `u16` underneath, so we can pass it by value. * Avoid unnecessary explicit lifetime parameters. * Use immutable references rather than mutable references. Patch inspired by:54baa4c38c
This commit is contained in:
@@ -62,12 +62,16 @@ pub fn wasi_common_cbindgen(attr: TokenStream, function: TokenStream) -> TokenSt
|
||||
arg_ident.push(quote!(#len_ident));
|
||||
arg_type.push(quote!(usize));
|
||||
} else {
|
||||
// & or &mut type
|
||||
// so simply substitute with *mut type
|
||||
arg_type.push(quote!(*mut #elem));
|
||||
// we need to properly dereference the substituted raw
|
||||
// pointer if we are to properly call the hostcall fn
|
||||
call_arg_ident.push(quote!(&mut *#ident));
|
||||
// & or &mut type; substitute with *const or *mut type.
|
||||
// Also, we need to properly dereference the substituted raw
|
||||
// pointer if we are to properly call the hostcall fn.
|
||||
if ty.mutability.is_none() {
|
||||
arg_type.push(quote!(*const #elem));
|
||||
call_arg_ident.push(quote!(&*#ident));
|
||||
} else {
|
||||
arg_type.push(quote!(*mut #elem));
|
||||
call_arg_ident.push(quote!(&mut *#ident));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
arg_type.push(quote!(#ty));
|
||||
|
||||
Reference in New Issue
Block a user