mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 05:32:44 +00:00 
			
		
		
		
	LibSQL: Remove superfluous VERIFYs for Vector accessing
				
					
				
			Remove some `[]` operators' out-of-bounds checks which are already performed by the underlying `Vector`.
This commit is contained in:
		
							parent
							
								
									234bc0c237
								
							
						
					
					
						commit
						0460a654d4
					
				
					 4 changed files with 3 additions and 23 deletions
				
			
		|  | @ -67,7 +67,7 @@ public: | ||||||
|     [[nodiscard]] TreeNode* down_node(size_t); |     [[nodiscard]] TreeNode* down_node(size_t); | ||||||
|     [[nodiscard]] bool is_leaf() const { return m_is_leaf; } |     [[nodiscard]] bool is_leaf() const { return m_is_leaf; } | ||||||
| 
 | 
 | ||||||
|     Key const& operator[](size_t) const; |     Key const& operator[](size_t index) const { return m_entries[index]; } | ||||||
|     bool insert(Key const&); |     bool insert(Key const&); | ||||||
|     bool update_key_pointer(Key const&); |     bool update_key_pointer(Key const&); | ||||||
|     TreeNode* node_for(Key const&); |     TreeNode* node_for(Key const&); | ||||||
|  |  | ||||||
|  | @ -197,21 +197,13 @@ bool TreeNode::insert_in_leaf(Key const& key) | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Key const& TreeNode::operator[](size_t ix) const |  | ||||||
| { |  | ||||||
|     VERIFY(ix < size()); |  | ||||||
|     return m_entries[ix]; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| u32 TreeNode::down_pointer(size_t ix) const | u32 TreeNode::down_pointer(size_t ix) const | ||||||
| { | { | ||||||
|     VERIFY(ix < m_down.size()); |  | ||||||
|     return m_down[ix].pointer(); |     return m_down[ix].pointer(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TreeNode* TreeNode::down_node(size_t ix) | TreeNode* TreeNode::down_node(size_t ix) | ||||||
| { | { | ||||||
|     VERIFY(ix < m_down.size()); |  | ||||||
|     return m_down[ix].node(); |     return m_down[ix].node(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -91,18 +91,6 @@ Optional<size_t> Tuple::index_of(String name) const | ||||||
|     return {}; |     return {}; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Value const& Tuple::operator[](size_t ix) const |  | ||||||
| { |  | ||||||
|     VERIFY(ix < m_data.size()); |  | ||||||
|     return m_data[ix]; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Value& Tuple::operator[](size_t ix) |  | ||||||
| { |  | ||||||
|     VERIFY(ix < m_data.size()); |  | ||||||
|     return m_data[ix]; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Value const& Tuple::operator[](String const& name) const | Value const& Tuple::operator[](String const& name) const | ||||||
| { | { | ||||||
|     auto index = index_of(name); |     auto index = index_of(name); | ||||||
|  |  | ||||||
|  | @ -49,8 +49,8 @@ public: | ||||||
|     [[nodiscard]] bool is_null() const { return m_data.is_empty(); } |     [[nodiscard]] bool is_null() const { return m_data.is_empty(); } | ||||||
|     [[nodiscard]] bool has(String const& name) const { return index_of(name).has_value(); } |     [[nodiscard]] bool has(String const& name) const { return index_of(name).has_value(); } | ||||||
| 
 | 
 | ||||||
|     Value const& operator[](size_t ix) const; |     Value const& operator[](size_t ix) const { return m_data[ix]; } | ||||||
|     Value& operator[](size_t ix); |     Value& operator[](size_t ix) { return m_data[ix]; } | ||||||
|     Value const& operator[](String const& name) const; |     Value const& operator[](String const& name) const; | ||||||
|     Value& operator[](String const& name); |     Value& operator[](String const& name); | ||||||
|     void append(Value const&); |     void append(Value const&); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jelle Raaijmakers
						Jelle Raaijmakers