Merge pull request #339 from ethereum/rust-ref

rust: make allocate_output_data operate on references
This commit is contained in:
Alex Beregszaszi 2019-07-03 12:19:46 +01:00 committed by GitHub
commit 32ceee35dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,