From cd49fb02296b3474b3b7a3008e47e7959d621ccf Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 13 Jun 2021 22:13:49 +0200 Subject: [PATCH] LibRegex: Remove return value for setters --- Userland/Libraries/LibRegex/RegexByteCode.cpp | 4 +++- Userland/Libraries/LibRegex/RegexByteCode.h | 12 ++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp index 7ac1cb97c5..2f05f61dde 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.cpp +++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp @@ -151,7 +151,9 @@ ALWAYS_INLINE OpCode* ByteCode::get_opcode_by_id(OpCodeId id) const if (id > OpCodeId::Last) return nullptr; - return const_cast(s_opcodes[(u32)id]->set_bytecode(*const_cast(this))); + auto* opcode = &*s_opcodes[(u32)id]; + opcode->set_bytecode(*const_cast(this)); + return opcode; } OpCode* ByteCode::get_opcode(MatchState& state) const diff --git a/Userland/Libraries/LibRegex/RegexByteCode.h b/Userland/Libraries/LibRegex/RegexByteCode.h index 4bd3a4dfc4..c7d610b584 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.h +++ b/Userland/Libraries/LibRegex/RegexByteCode.h @@ -496,17 +496,9 @@ public: ALWAYS_INLINE const char* name() const; static const char* name(const OpCodeId); - ALWAYS_INLINE OpCode* set_state(MatchState& state) - { - m_state = &state; - return this; - } + ALWAYS_INLINE void set_state(MatchState& state) { m_state = &state; } - ALWAYS_INLINE OpCode* set_bytecode(ByteCode& bytecode) - { - m_bytecode = &bytecode; - return this; - } + ALWAYS_INLINE void set_bytecode(ByteCode& bytecode) { m_bytecode = &bytecode; } ALWAYS_INLINE void reset_state() { m_state.clear(); }