diff options
author | David Snopek <dsnopek@gmail.com> | 2023-10-09 16:59:29 -0500 |
---|---|---|
committer | David Snopek <dsnopek@gmail.com> | 2023-10-09 16:59:29 -0500 |
commit | 3d814f9e4a7d8a3983970928406ed2eba6ac8241 (patch) | |
tree | 064f1eb4ac9214ba0f17271389317852f5fb3962 /src | |
parent | ef2f63a00c5496cc325e8546acd743787e87a83d (diff) | |
download | redot-cpp-3d814f9e4a7d8a3983970928406ed2eba6ac8241.tar.gz |
Use the new `string_name_new_with_latin1_chars` function to improve StringName construction performance
Diffstat (limited to 'src')
-rw-r--r-- | src/godot.cpp | 2 | ||||
-rw-r--r-- | src/variant/char_string.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/godot.cpp b/src/godot.cpp index 05413ff..7fc8afa 100644 --- a/src/godot.cpp +++ b/src/godot.cpp @@ -130,6 +130,7 @@ GDExtensionInterfaceStringOperatorPlusEqCstr gdextension_interface_string_operat GDExtensionInterfaceStringOperatorPlusEqWcstr gdextension_interface_string_operator_plus_eq_wcstr = nullptr; GDExtensionInterfaceStringOperatorPlusEqC32str gdextension_interface_string_operator_plus_eq_c32str = nullptr; GDExtensionInterfaceStringResize gdextension_interface_string_resize = nullptr; +GDExtensionInterfaceStringNameNewWithLatin1Chars gdextension_interface_string_name_new_with_latin1_chars = nullptr; GDExtensionInterfaceXmlParserOpenBuffer gdextension_interface_xml_parser_open_buffer = nullptr; GDExtensionInterfaceFileAccessStoreBuffer gdextension_interface_file_access_store_buffer = nullptr; GDExtensionInterfaceFileAccessGetBuffer gdextension_interface_file_access_get_buffer = nullptr; @@ -347,6 +348,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge LOAD_PROC_ADDRESS(string_operator_plus_eq_wcstr, GDExtensionInterfaceStringOperatorPlusEqWcstr); LOAD_PROC_ADDRESS(string_operator_plus_eq_c32str, GDExtensionInterfaceStringOperatorPlusEqC32str); LOAD_PROC_ADDRESS(string_resize, GDExtensionInterfaceStringResize); + LOAD_PROC_ADDRESS(string_name_new_with_latin1_chars, GDExtensionInterfaceStringNameNewWithLatin1Chars); LOAD_PROC_ADDRESS(xml_parser_open_buffer, GDExtensionInterfaceXmlParserOpenBuffer); LOAD_PROC_ADDRESS(file_access_store_buffer, GDExtensionInterfaceFileAccessStoreBuffer); LOAD_PROC_ADDRESS(file_access_get_buffer, GDExtensionInterfaceFileAccessGetBuffer); diff --git a/src/variant/char_string.cpp b/src/variant/char_string.cpp index fc8845e..a4083bf 100644 --- a/src/variant/char_string.cpp +++ b/src/variant/char_string.cpp @@ -458,8 +458,9 @@ String operator+(char32_t p_char, const String &p_str) { return String::chr(p_char) + p_str; } -StringName::StringName(const char *from) : - StringName(String(from)) {} +StringName::StringName(const char *from, bool p_static) { + internal::gdextension_interface_string_name_new_with_latin1_chars(&opaque, from, p_static); +} StringName::StringName(const wchar_t *from) : StringName(String(from)) {} |