From ea56a2392f5f1af1266ad0c3bc420188e3f9f751 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 22 Apr 2019 00:11:43 -0700 Subject: [PATCH] wasm: remove unused parameter from getUserSection(). (#58) Signed-off-by: Piotr Sikora --- source/extensions/common/wasm/wasm.h | 5 ++--- source/extensions/common/wasm/wavm/wavm.cc | 10 ++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/source/extensions/common/wasm/wasm.h b/source/extensions/common/wasm/wasm.h index db91d5bffb96..89d39fbc6cfe 100644 --- a/source/extensions/common/wasm/wasm.h +++ b/source/extensions/common/wasm/wasm.h @@ -518,9 +518,8 @@ class WasmVm : public Logger::Loggable { // Make a new intrinsic module (e.g. for Emscripten support). virtual void makeModule(absl::string_view name) PURE; - // Get the contents of the user section with the given name or "" if it does not exist and - // optionally a presence indicator. - virtual absl::string_view getUserSection(absl::string_view name, bool* present = nullptr) PURE; + // Get the contents of the user section with the given name or "" if it does not exist. + virtual absl::string_view getUserSection(absl::string_view name) PURE; // Get typed function exported by the WASM module. virtual void getFunction(absl::string_view functionName, WasmCall0Void* f) PURE; diff --git a/source/extensions/common/wasm/wavm/wavm.cc b/source/extensions/common/wasm/wavm/wavm.cc index 44c5ff75051b..12755cabe6d5 100644 --- a/source/extensions/common/wasm/wavm/wavm.cc +++ b/source/extensions/common/wasm/wavm/wavm.cc @@ -228,7 +228,7 @@ struct Wavm : public WasmVm { bool getMemoryOffset(void* host_pointer, uint32_t* vm_pointer) override; bool setMemory(uint32_t pointer, uint32_t size, void* data) override; void makeModule(absl::string_view name) override; - absl::string_view getUserSection(absl::string_view name, bool* present) override; + absl::string_view getUserSection(absl::string_view name) override; void getInstantiatedGlobals(); @@ -444,18 +444,12 @@ bool Wavm::setMemory(uint32_t pointer, uint32_t size, void* data) { } } -absl::string_view Wavm::getUserSection(absl::string_view name, bool* present) { +absl::string_view Wavm::getUserSection(absl::string_view name) { for (auto& section : irModule_.userSections) { if (section.name == name) { - if (present) { - *present = true; - } return {reinterpret_cast(section.data.data()), section.data.size()}; } } - if (present) { - *present = false; - } return {}; }