summaryrefslogtreecommitdiff
path: root/core/string_name.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/string_name.cpp')
-rw-r--r--core/string_name.cpp29
1 files changed, 0 insertions, 29 deletions
diff --git a/core/string_name.cpp b/core/string_name.cpp
index bfc10d96e4..5e6d56e516 100644
--- a/core/string_name.cpp
+++ b/core/string_name.cpp
@@ -42,7 +42,6 @@ StaticCString StaticCString::create(const char *p_ptr) {
StringName::_Data *StringName::_table[STRING_TABLE_LEN];
StringName _scs_create(const char *p_chr) {
-
return (p_chr[0] ? StringName(StaticCString::create(p_chr)) : StringName());
}
@@ -50,24 +49,19 @@ bool StringName::configured = false;
Mutex StringName::mutex;
void StringName::setup() {
-
ERR_FAIL_COND(configured);
for (int i = 0; i < STRING_TABLE_LEN; i++) {
-
_table[i] = nullptr;
}
configured = true;
}
void StringName::cleanup() {
-
MutexLock lock(mutex);
int lost_strings = 0;
for (int i = 0; i < STRING_TABLE_LEN; i++) {
-
while (_table[i]) {
-
_Data *d = _table[i];
lost_strings++;
if (OS::get_singleton()->is_stdout_verbose()) {
@@ -88,11 +82,9 @@ void StringName::cleanup() {
}
void StringName::unref() {
-
ERR_FAIL_COND(!configured);
if (_data && _data->refcount.unref()) {
-
MutexLock lock(mutex);
if (_data->prev) {
@@ -114,9 +106,7 @@ void StringName::unref() {
}
bool StringName::operator==(const String &p_name) const {
-
if (!_data) {
-
return (p_name.length() == 0);
}
@@ -124,9 +114,7 @@ bool StringName::operator==(const String &p_name) const {
}
bool StringName::operator==(const char *p_name) const {
-
if (!_data) {
-
return (p_name[0] == 0);
}
@@ -134,32 +122,27 @@ bool StringName::operator==(const char *p_name) const {
}
bool StringName::operator!=(const String &p_name) const {
-
return !(operator==(p_name));
}
bool StringName::operator!=(const StringName &p_name) const {
-
// the real magic of all this mess happens here.
// this is why path comparisons are very fast
return _data != p_name._data;
}
void StringName::operator=(const StringName &p_name) {
-
if (this == &p_name)
return;
unref();
if (p_name._data && p_name._data->refcount.ref()) {
-
_data = p_name._data;
}
}
StringName::StringName(const StringName &p_name) {
-
_data = nullptr;
ERR_FAIL_COND(!configured);
@@ -170,7 +153,6 @@ StringName::StringName(const StringName &p_name) {
}
StringName::StringName(const char *p_name) {
-
_data = nullptr;
ERR_FAIL_COND(!configured);
@@ -187,7 +169,6 @@ StringName::StringName(const char *p_name) {
_data = _table[idx];
while (_data) {
-
// compare hash first
if (_data->hash == hash && _data->get_name() == p_name)
break;
@@ -215,7 +196,6 @@ StringName::StringName(const char *p_name) {
}
StringName::StringName(const StaticCString &p_static_string) {
-
_data = nullptr;
ERR_FAIL_COND(!configured);
@@ -231,7 +211,6 @@ StringName::StringName(const StaticCString &p_static_string) {
_data = _table[idx];
while (_data) {
-
// compare hash first
if (_data->hash == hash && _data->get_name() == p_static_string.ptr)
break;
@@ -259,7 +238,6 @@ StringName::StringName(const StaticCString &p_static_string) {
}
StringName::StringName(const String &p_name) {
-
_data = nullptr;
ERR_FAIL_COND(!configured);
@@ -275,7 +253,6 @@ StringName::StringName(const String &p_name) {
_data = _table[idx];
while (_data) {
-
if (_data->hash == hash && _data->get_name() == p_name)
break;
_data = _data->next;
@@ -302,7 +279,6 @@ StringName::StringName(const String &p_name) {
}
StringName StringName::search(const char *p_name) {
-
ERR_FAIL_COND_V(!configured, StringName());
ERR_FAIL_COND_V(!p_name, StringName());
@@ -317,7 +293,6 @@ StringName StringName::search(const char *p_name) {
_Data *_data = _table[idx];
while (_data) {
-
// compare hash first
if (_data->hash == hash && _data->get_name() == p_name)
break;
@@ -332,7 +307,6 @@ StringName StringName::search(const char *p_name) {
}
StringName StringName::search(const CharType *p_name) {
-
ERR_FAIL_COND_V(!configured, StringName());
ERR_FAIL_COND_V(!p_name, StringName());
@@ -348,7 +322,6 @@ StringName StringName::search(const CharType *p_name) {
_Data *_data = _table[idx];
while (_data) {
-
// compare hash first
if (_data->hash == hash && _data->get_name() == p_name)
break;
@@ -362,7 +335,6 @@ StringName StringName::search(const CharType *p_name) {
return StringName(); //does not exist
}
StringName StringName::search(const String &p_name) {
-
ERR_FAIL_COND_V(p_name == "", StringName());
MutexLock lock(mutex);
@@ -374,7 +346,6 @@ StringName StringName::search(const String &p_name) {
_Data *_data = _table[idx];
while (_data) {
-
// compare hash first
if (_data->hash == hash && p_name == _data->get_name())
break;