From b4c585f9bdd78a9ab62d6f43bc01a8c2916d630b Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 25 Jun 2019 19:52:27 +0100 Subject: [PATCH] rust: make allocate_output_data operate on references --- bindings/rust/evmc-vm/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/rust/evmc-vm/src/lib.rs b/bindings/rust/evmc-vm/src/lib.rs index 9c7ab37..eecbe91 100644 --- a/bindings/rust/evmc-vm/src/lib.rs +++ b/bindings/rust/evmc-vm/src/lib.rs @@ -325,7 +325,7 @@ impl From for ExecutionResult { } } -fn allocate_output_data(output: Option>) -> (*const u8, usize) { +fn allocate_output_data(output: Option<&Vec>) -> (*const u8, usize) { if let Some(buf) = output { let buf_len = buf.len(); @@ -370,7 +370,7 @@ extern "C" fn release_heap_result(result: *const ffi::evmc_result) { /// Returns a pointer to a stack-allocated evmc_result. impl Into for ExecutionResult { fn into(self) -> ffi::evmc_result { - let (buffer, len) = allocate_output_data(self.output); + let (buffer, len) = allocate_output_data(self.output.as_ref()); ffi::evmc_result { status_code: self.status_code, gas_left: self.gas_left,