mirror of
https://github.com/status-im/evmc.git
synced 2025-02-22 16:08:22 +00:00
Return result from call_fn
This changes the evmc_call_fn signature to return evmc_result object instead of getting result as an output parameter.
This commit is contained in:
parent
6768aa888e
commit
3c86a6b934
@ -208,7 +208,7 @@ func emitLog(pCtx unsafe.Pointer, pAddr *C.struct_evmc_address, pData unsafe.Poi
|
|||||||
}
|
}
|
||||||
|
|
||||||
//export call
|
//export call
|
||||||
func call(pResult *C.struct_evmc_result, pCtx unsafe.Pointer, msg *C.struct_evmc_message) {
|
func call(pCtx unsafe.Pointer, msg *C.struct_evmc_message) C.struct_evmc_result {
|
||||||
idx := int((*C.struct_extended_context)(pCtx).index)
|
idx := int((*C.struct_extended_context)(pCtx).index)
|
||||||
ctx := getHostContext(idx)
|
ctx := getHostContext(idx)
|
||||||
|
|
||||||
@ -234,5 +234,5 @@ func call(pResult *C.struct_evmc_result, pCtx unsafe.Pointer, msg *C.struct_evmc
|
|||||||
result.release = (C.evmc_release_result_fn)(C.evmc_go_free_result_output)
|
result.release = (C.evmc_release_result_fn)(C.evmc_go_free_result_output)
|
||||||
}
|
}
|
||||||
|
|
||||||
*pResult = result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -118,13 +118,12 @@ static void selfdestruct(struct evmc_context* context,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void call(struct evmc_result* result,
|
static struct evmc_result call(struct evmc_context* context, const struct evmc_message* msg)
|
||||||
struct evmc_context* context,
|
|
||||||
const struct evmc_message* msg)
|
|
||||||
{
|
{
|
||||||
(void)context;
|
(void)context;
|
||||||
printf("EVM-C: CALL (depth: %d)\n", msg->depth);
|
printf("EVM-C: CALL (depth: %d)\n", msg->depth);
|
||||||
result->status_code = EVMC_FAILURE;
|
struct evmc_result result = {.status_code = EVMC_FAILURE};
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_tx_context(struct evmc_tx_context* result, struct evmc_context* context)
|
static void get_tx_context(struct evmc_tx_context* result, struct evmc_context* context)
|
||||||
|
@ -574,16 +574,12 @@ typedef void (*evmc_emit_log_fn)(struct evmc_context* context,
|
|||||||
/**
|
/**
|
||||||
* Pointer to the callback function supporting EVM calls.
|
* Pointer to the callback function supporting EVM calls.
|
||||||
*
|
*
|
||||||
* @param[out] result The result of the call. The result object is not
|
* @param context The pointer to the Host execution context.
|
||||||
* initialized by the EVM, the Client MUST correctly
|
* @param msg The call parameters.
|
||||||
* initialize all expected fields of the structure.
|
* @return The result of the call.
|
||||||
* @param context The pointer to the Host execution context.
|
|
||||||
* @see ::evmc_context.
|
|
||||||
* @param msg Call parameters. @see ::evmc_message.
|
|
||||||
*/
|
*/
|
||||||
typedef void (*evmc_call_fn)(struct evmc_result* result,
|
typedef struct evmc_result (*evmc_call_fn)(struct evmc_context* context,
|
||||||
struct evmc_context* context,
|
const struct evmc_message* msg);
|
||||||
const struct evmc_message* msg);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The context interface.
|
* The context interface.
|
||||||
|
@ -88,11 +88,13 @@ static void selfdestruct(evmc_context* context,
|
|||||||
(void)beneficiary;
|
(void)beneficiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void call(evmc_result* result, evmc_context* context, const evmc_message* msg)
|
static evmc_result call(evmc_context* context, const evmc_message* msg)
|
||||||
{
|
{
|
||||||
(void)context;
|
(void)context;
|
||||||
(void)msg;
|
(void)msg;
|
||||||
result->status_code = EVMC_FAILURE;
|
evmc_result result{};
|
||||||
|
result.status_code = EVMC_FAILURE;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_tx_context(evmc_tx_context* result, evmc_context* context)
|
static void get_tx_context(evmc_tx_context* result, evmc_context* context)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user