wiggle-generate: always pass GuestPtr by reference
with the prev approach, it would be passed by reference sometimes (e.g. when used as an Array argument) but by value most of the time. this was inconsistient. theres no need to pass the owned version, all operations are &self.
This commit is contained in:
@@ -13,9 +13,9 @@ impl<'a> pointers::Pointers for WasiCtx<'a> {
|
||||
fn pointers_and_enums<'b>(
|
||||
&self,
|
||||
input1: types::Excuse,
|
||||
input2_ptr: GuestPtr<'b, types::Excuse>,
|
||||
input3_ptr: GuestPtr<'b, types::Excuse>,
|
||||
input4_ptr_ptr: GuestPtr<'b, GuestPtr<'b, types::Excuse>>,
|
||||
input2_ptr: &GuestPtr<'b, types::Excuse>,
|
||||
input3_ptr: &GuestPtr<'b, types::Excuse>,
|
||||
input4_ptr_ptr: &GuestPtr<'b, GuestPtr<'b, types::Excuse>>,
|
||||
) -> Result<(), types::Errno> {
|
||||
println!("BAZ input1 {:?}", input1);
|
||||
let input2: types::Excuse = input2_ptr.read().map_err(|e| {
|
||||
@@ -52,7 +52,7 @@ impl<'a> pointers::Pointers for WasiCtx<'a> {
|
||||
println!("input4 {:?}", input4);
|
||||
|
||||
// Write ptr value to mutable ptr:
|
||||
input4_ptr_ptr.write(input2_ptr).map_err(|e| {
|
||||
input4_ptr_ptr.write(*input2_ptr).map_err(|e| {
|
||||
eprintln!("input4_ptr_ptr error: {}", e);
|
||||
types::Errno::InvalidArg
|
||||
})?;
|
||||
|
||||
Reference in New Issue
Block a user