Skip to content

Commit baf9d6e

Browse files
committed
Merge pull request #105871 from Ivorforce/quick-stringname-fixes
Quick `StringName` improvements.
2 parents fb08e94 + 91362a6 commit baf9d6e

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

core/string/string_name.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "string_name.h"
3232

33+
#include "core/os/mutex.h"
3334
#include "core/os/os.h"
3435
#include "core/string/print_string.h"
3536

@@ -176,14 +177,6 @@ int StringName::length() const {
176177
return 0;
177178
}
178179

179-
bool StringName::is_empty() const {
180-
if (_data) {
181-
return _data->name.is_empty();
182-
}
183-
184-
return true;
185-
}
186-
187180
StringName &StringName::operator=(const StringName &p_name) {
188181
if (this == &p_name) {
189182
return *this;

core/string/string_name.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#pragma once
3232

33-
#include "core/os/mutex.h"
3433
#include "core/string/ustring.h"
3534
#include "core/templates/safe_refcount.h"
3635

@@ -78,7 +77,7 @@ class StringName {
7877
StringName(_Data *p_data) { _data = p_data; }
7978

8079
public:
81-
explicit operator bool() const { return _data && !_data->name.is_empty(); }
80+
_FORCE_INLINE_ explicit operator bool() const { return _data; }
8281

8382
bool operator==(const String &p_name) const;
8483
bool operator==(const char *p_name) const;
@@ -88,7 +87,7 @@ class StringName {
8887
const char32_t *get_data() const { return _data ? _data->name.ptr() : U""; }
8988
char32_t operator[](int p_index) const;
9089
int length() const;
91-
bool is_empty() const;
90+
_FORCE_INLINE_ bool is_empty() const { return !_data; }
9291

9392
_FORCE_INLINE_ bool is_node_unique_name() const {
9493
if (!_data) {

modules/jolt_physics/spaces/jolt_contact_listener_3d.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#pragma once
3232

33+
#include "core/os/mutex.h"
3334
#include "core/templates/hash_map.h"
3435
#include "core/templates/hash_set.h"
3536
#include "core/templates/hashfuncs.h"

0 commit comments

Comments
 (0)