You've already forked godot
							
							
				mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 12:00:25 +00:00 
			
		
		
		
	Remove unused StringName::search.
				
					
				
			This commit is contained in:
		@@ -314,99 +314,6 @@ StringName::StringName(const String &p_name, bool p_static) {
 | 
			
		||||
	Table::table[idx] = _data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
StringName StringName::search(const char *p_name) {
 | 
			
		||||
	ERR_FAIL_COND_V(!configured, StringName());
 | 
			
		||||
 | 
			
		||||
	ERR_FAIL_NULL_V(p_name, StringName());
 | 
			
		||||
	if (!p_name[0]) {
 | 
			
		||||
		return StringName();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const uint32_t hash = String::hash(p_name);
 | 
			
		||||
	const uint32_t idx = hash & Table::TABLE_MASK;
 | 
			
		||||
 | 
			
		||||
	MutexLock lock(Table::mutex);
 | 
			
		||||
	_Data *_data = Table::table[idx];
 | 
			
		||||
 | 
			
		||||
	while (_data) {
 | 
			
		||||
		// compare hash first
 | 
			
		||||
		if (_data->hash == hash && _data->name == p_name) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		_data = _data->next;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (_data && _data->refcount.ref()) {
 | 
			
		||||
#ifdef DEBUG_ENABLED
 | 
			
		||||
		if (unlikely(debug_stringname)) {
 | 
			
		||||
			_data->debug_references++;
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		return StringName(_data);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return StringName(); //does not exist
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
StringName StringName::search(const char32_t *p_name) {
 | 
			
		||||
	ERR_FAIL_COND_V(!configured, StringName());
 | 
			
		||||
 | 
			
		||||
	ERR_FAIL_NULL_V(p_name, StringName());
 | 
			
		||||
	if (!p_name[0]) {
 | 
			
		||||
		return StringName();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const uint32_t hash = String::hash(p_name);
 | 
			
		||||
	const uint32_t idx = hash & Table::TABLE_MASK;
 | 
			
		||||
 | 
			
		||||
	MutexLock lock(Table::mutex);
 | 
			
		||||
	_Data *_data = Table::table[idx];
 | 
			
		||||
 | 
			
		||||
	while (_data) {
 | 
			
		||||
		// compare hash first
 | 
			
		||||
		if (_data->hash == hash && _data->name == p_name) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		_data = _data->next;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (_data && _data->refcount.ref()) {
 | 
			
		||||
		return StringName(_data);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return StringName(); //does not exist
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
StringName StringName::search(const String &p_name) {
 | 
			
		||||
	ERR_FAIL_COND_V(p_name.is_empty(), StringName());
 | 
			
		||||
 | 
			
		||||
	const uint32_t hash = p_name.hash();
 | 
			
		||||
	const uint32_t idx = hash & Table::TABLE_MASK;
 | 
			
		||||
 | 
			
		||||
	MutexLock lock(Table::mutex);
 | 
			
		||||
	_Data *_data = Table::table[idx];
 | 
			
		||||
 | 
			
		||||
	while (_data) {
 | 
			
		||||
		// compare hash first
 | 
			
		||||
		if (_data->hash == hash && _data->name == p_name) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		_data = _data->next;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (_data && _data->refcount.ref()) {
 | 
			
		||||
#ifdef DEBUG_ENABLED
 | 
			
		||||
		if (unlikely(debug_stringname)) {
 | 
			
		||||
			_data->debug_references++;
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		return StringName(_data);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return StringName(); //does not exist
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool operator==(const String &p_name, const StringName &p_string_name) {
 | 
			
		||||
	return p_string_name.operator==(p_name);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -134,10 +134,6 @@ public:
 | 
			
		||||
		return String();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static StringName search(const char *p_name);
 | 
			
		||||
	static StringName search(const char32_t *p_name);
 | 
			
		||||
	static StringName search(const String &p_name);
 | 
			
		||||
 | 
			
		||||
	struct AlphCompare {
 | 
			
		||||
		template <typename LT, typename RT>
 | 
			
		||||
		_FORCE_INLINE_ bool operator()(const LT &l, const RT &r) const {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user