rust: make allocate_output_data operate on references

This commit is contained in:
Alex Beregszaszi 2019-06-25 19:52:27 +01:00
parent 9794d7c2f7
commit b4c585f9bd
1 changed files with 2 additions and 2 deletions

View File

@ -325,7 +325,7 @@ impl From<ffi::evmc_result> for ExecutionResult {
}
}
fn allocate_output_data(output: Option<Vec<u8>>) -> (*const u8, usize) {
fn allocate_output_data(output: Option<&Vec<u8>>) -> (*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<ffi::evmc_result> 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,