mirror of https://github.com/status-im/evmc.git
cpp: Rename result::raw() to result::release_raw()
This commit is contained in:
parent
8423fac003
commit
594da7553e
|
@ -56,9 +56,15 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the raw copy of evmc_result,
|
/// Releases the ownership and returns the raw copy of evmc_result.
|
||||||
/// releases the ownership of the resources and invalidates this object.
|
///
|
||||||
evmc_result raw() noexcept
|
/// This method drops the ownership of the result
|
||||||
|
/// (result's resources are not going to be released when this object is destructed).
|
||||||
|
/// It is the caller's responsibility having the returned copy of the result to release it.
|
||||||
|
/// This object MUST NOT be used after this method is invoked.
|
||||||
|
///
|
||||||
|
/// @return The copy of this object converted to raw evmc_result.
|
||||||
|
evmc_result release_raw() noexcept
|
||||||
{
|
{
|
||||||
const auto out = evmc_result{*this}; // Copy data.
|
const auto out = evmc_result{*this}; // Copy data.
|
||||||
this->release = nullptr; // Disable releasing of this object.
|
this->release = nullptr; // Disable releasing of this object.
|
||||||
|
@ -321,7 +327,7 @@ inline void selfdestruct(evmc_context* h,
|
||||||
}
|
}
|
||||||
inline evmc_result call(evmc_context* h, const evmc_message* msg) noexcept
|
inline evmc_result call(evmc_context* h, const evmc_message* msg) noexcept
|
||||||
{
|
{
|
||||||
return static_cast<Host*>(h)->call(*msg).raw();
|
return static_cast<Host*>(h)->call(*msg).release_raw();
|
||||||
}
|
}
|
||||||
inline evmc_tx_context get_tx_context(evmc_context* h) noexcept
|
inline evmc_tx_context get_tx_context(evmc_context* h) noexcept
|
||||||
{
|
{
|
||||||
|
|
|
@ -141,7 +141,7 @@ TEST(cpp, result_raii)
|
||||||
EXPECT_EQ(raii_result.gas_left, 0);
|
EXPECT_EQ(raii_result.gas_left, 0);
|
||||||
raii_result.gas_left = -1;
|
raii_result.gas_left = -1;
|
||||||
|
|
||||||
auto raw_result2 = raii_result.raw();
|
auto raw_result2 = raii_result.release_raw();
|
||||||
EXPECT_EQ(raw_result2.status_code, EVMC_INTERNAL_ERROR);
|
EXPECT_EQ(raw_result2.status_code, EVMC_INTERNAL_ERROR);
|
||||||
EXPECT_EQ(raw_result.status_code, EVMC_INTERNAL_ERROR);
|
EXPECT_EQ(raw_result.status_code, EVMC_INTERNAL_ERROR);
|
||||||
EXPECT_EQ(raw_result2.gas_left, -1);
|
EXPECT_EQ(raw_result2.gas_left, -1);
|
||||||
|
|
Loading…
Reference in New Issue