Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replace static_cast of forwarding references with std::forward #967

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/chain/webassembly/runtimes/eos-vm-oc/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

extern "C" int arch_prctl(int code, unsigned long* addr);

namespace eosio { namespace chain { namespace eosvmoc {
namespace eosio::chain::eosvmoc {

static constexpr auto signal_sentinel = 0x4D56534F45534559ul;

Expand Down Expand Up @@ -265,4 +265,4 @@ executor::~executor() {
munmap(code_mapping, code_mapping_size);
}

}}}
}
8 changes: 4 additions & 4 deletions libraries/chain/webassembly/runtimes/eos-vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace {
template<typename F>
struct guard {
guard(transaction_checktime_timer& timer, F&& func)
: _timer(timer), _func(static_cast<F&&>(func)) {
: _timer(timer), _func(std::forward<F>(func)) {
_timer.set_expiration_callback(&callback, this);
if(_timer.expired) {
_func(); // it's harmless if _func is invoked twice
Expand All @@ -45,7 +45,7 @@ namespace {
};
template<typename F>
guard<F> scoped_run(F&& func) {
return guard{_timer, static_cast<F&&>(func)};
return guard{_timer, std::forward<F>(func)};
}
transaction_checktime_timer& _timer;
};
Expand Down Expand Up @@ -158,7 +158,7 @@ class eos_vm_instantiated_module : public wasm_instantiated_module_interface {
};
try {
checktime_watchdog wd(context.trx_context.transaction_timer);
_runtime->_bkend.timed_run(wd, fn);
_runtime->_bkend.timed_run(std::move(wd), std::move(fn));
} catch(eosio::vm::timeout_exception&) {
context.trx_context.checktime();
} catch(eosio::vm::wasm_memory_exception& e) {
Expand Down Expand Up @@ -202,7 +202,7 @@ class eos_vm_profiling_module : public wasm_instantiated_module_interface {
try {
scoped_profile profile_runner(prof);
checktime_watchdog wd(context.trx_context.transaction_timer);
_instantiated_module->timed_run(wd, fn);
_instantiated_module->timed_run(std::move(wd), std::move(fn));
} catch(eosio::vm::timeout_exception&) {
context.trx_context.checktime();
} catch(eosio::vm::wasm_memory_exception& e) {
Expand Down
Loading