mirror of https://github.com/status-im/evmc.git
cpp: Return reference (not pointer) from Host::get_interface()
This commit is contained in:
parent
95737d2721
commit
79aad8ae08
|
@ -162,7 +162,7 @@ extern "C" {
|
|||
|
||||
const evmc_host_interface* example_host_get_interface()
|
||||
{
|
||||
return evmc::Host::get_interface();
|
||||
return &evmc::Host::get_interface();
|
||||
}
|
||||
|
||||
evmc_host_context* example_host_create_context(evmc_tx_context tx_context)
|
||||
|
|
|
@ -596,8 +596,8 @@ class Host : public HostInterface
|
|||
{
|
||||
public:
|
||||
/// Provides access to the global host interface.
|
||||
/// @returns Pointer to the host interface object.
|
||||
static const evmc_host_interface* get_interface() noexcept;
|
||||
/// @returns Reference to the host interface object.
|
||||
static const evmc_host_interface& get_interface() noexcept;
|
||||
|
||||
/// Converts the Host object to the opaque host context pointer.
|
||||
/// @returns Pointer to evmc_host_context.
|
||||
|
@ -698,7 +698,7 @@ inline void emit_log(evmc_host_context* h,
|
|||
}
|
||||
} // namespace internal
|
||||
|
||||
inline const evmc_host_interface* Host::get_interface() noexcept
|
||||
inline const evmc_host_interface& Host::get_interface() noexcept
|
||||
{
|
||||
static constexpr evmc_host_interface interface{
|
||||
::evmc::internal::account_exists, ::evmc::internal::get_storage,
|
||||
|
@ -707,7 +707,7 @@ inline const evmc_host_interface* Host::get_interface() noexcept
|
|||
::evmc::internal::copy_code, ::evmc::internal::selfdestruct,
|
||||
::evmc::internal::call, ::evmc::internal::get_tx_context,
|
||||
::evmc::internal::get_block_hash, ::evmc::internal::emit_log};
|
||||
return &interface;
|
||||
return interface;
|
||||
}
|
||||
} // namespace evmc
|
||||
|
||||
|
|
Loading…
Reference in New Issue