summaryrefslogtreecommitdiffstats
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-25 00:07:54 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-11-25 00:09:40 -0300
commitbc2e8d99e5ae0dbd69e712cc71da3033f5f30139 (patch)
treed836011e3d5873e3ceea328ea3100f3c7719ab99 /core/ustring.cpp
parent7dfba3cda9f13427f9f10a6eefbec52aef62274c (diff)
downloadredot-engine-bc2e8d99e5ae0dbd69e712cc71da3033f5f30139.tar.gz
Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 8d40f56386..a86fb46c8a 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -115,7 +115,7 @@ void String::copy_from(const char *p_cstr) {
resize(len + 1); // include 0
- CharType *dst = this->ptr();
+ CharType *dst = this->ptrw();
for (int i = 0; i < len + 1; i++) {
@@ -1119,7 +1119,7 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
chars++;
String s;
s.resize(chars + 1);
- CharType *c = s.ptr();
+ CharType *c = s.ptrw();
c[chars] = 0;
n = num;
do {