浏览代码

LibRegex: Remove return value for setters

Gunnar Beutner 4 年之前
父节点
当前提交
cd49fb0229
共有 2 个文件被更改,包括 5 次插入11 次删除
  1. 3 1
      Userland/Libraries/LibRegex/RegexByteCode.cpp
  2. 2 10
      Userland/Libraries/LibRegex/RegexByteCode.h

+ 3 - 1
Userland/Libraries/LibRegex/RegexByteCode.cpp

@@ -151,7 +151,9 @@ ALWAYS_INLINE OpCode* ByteCode::get_opcode_by_id(OpCodeId id) const
     if (id > OpCodeId::Last)
     if (id > OpCodeId::Last)
         return nullptr;
         return nullptr;
 
 
-    return const_cast<OpCode*>(s_opcodes[(u32)id]->set_bytecode(*const_cast<ByteCode*>(this)));
+    auto* opcode = &*s_opcodes[(u32)id];
+    opcode->set_bytecode(*const_cast<ByteCode*>(this));
+    return opcode;
 }
 }
 
 
 OpCode* ByteCode::get_opcode(MatchState& state) const
 OpCode* ByteCode::get_opcode(MatchState& state) const

+ 2 - 10
Userland/Libraries/LibRegex/RegexByteCode.h

@@ -496,17 +496,9 @@ public:
     ALWAYS_INLINE const char* name() const;
     ALWAYS_INLINE const char* name() const;
     static const char* name(const OpCodeId);
     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(); }
     ALWAYS_INLINE void reset_state() { m_state.clear(); }