1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #100314 from Ivorforce/use-string-chr

Optimize `String::chr` to avoid calling `strlen`. Use `String::chr` instead of `String(&chr, 1)` where appropriate.
This commit is contained in:
Thaddeus Crews
2025-03-13 08:57:20 -05:00
4 changed files with 8 additions and 11 deletions

View File

@@ -1337,7 +1337,7 @@ void GDScriptTokenizerText::check_indent() {
}
String GDScriptTokenizerText::_get_indent_char_name(char32_t ch) {
ERR_FAIL_COND_V(ch != ' ' && ch != '\t', String(&ch, 1).c_escape());
ERR_FAIL_COND_V(ch != ' ' && ch != '\t', String::chr(ch).c_escape());
return ch == ' ' ? "space" : "tab";
}