This commit is contained in:
Spartan322
2025-06-20 02:38:24 -04:00
699 changed files with 21288 additions and 9565 deletions

View File

@@ -316,99 +316,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);
}