EVM-C: Change evm_destroy_result() to evm_release_result_resources()

Be explicit how releasing execution result works. Also pass result by pointer.
This commit is contained in:
Paweł Bylica 2016-08-22 21:20:02 +02:00
parent 6c4089ad80
commit 2b6773f128
2 changed files with 12 additions and 4 deletions

View File

@ -29,9 +29,10 @@ void example() {
int64_t gas = 200000;
struct evm_result result =
evm_execute(jit, NULL, code_hash, code, sizeof(code), gas, input,
evm_execute(jit, NULL, EVM_FRONTIER, code_hash, (uint8_t const*)code,
sizeof(code), gas, (uint8_t const*)input,
sizeof(input), value);
evm_destroy_result(result);
evm_release_result_resources(&result);
evm_destroy(jit);
}

View File

@ -328,8 +328,15 @@ EXPORT struct evm_result evm_execute(struct evm_instance* instance,
size_t input_size,
struct evm_uint256 value);
/// Destroys execution result.
EXPORT void evm_destroy_result(struct evm_result);
/// Releases the resources assigned to the execution result.
///
/// This function releases memory (and other resources, if any) assigned to the
/// specified execution result making the result object invalid.
///
/// @param result The execution result which resource are to be released. The
/// result itself it not modified by this function, but becomes
/// invalid and user should discard it as well.
EXPORT void evm_release_result_resources(struct evm_result const* result);
/// @defgroup EVMJIT EVMJIT extenstion to EVM-C