cpp: Return reference (not pointer) from Host::get_interface()

This commit is contained in:
Paweł Bylica 2019-11-06 13:20:06 +01:00
parent 95737d2721
commit 79aad8ae08
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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