summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-12-16 19:13:35 +0100
committerGitHub <noreply@github.com>2018-12-16 19:13:35 +0100
commit9c7bc127b9f719b4fe6a14dd2c8745fc64cf1b32 (patch)
tree19ef5ec49f3737f9b44485740328d8f1a97085fe /core/ustring.cpp
parent169db6abdd9d8973822dc5f2a4ce5bcf00bb3f55 (diff)
parent4e25e5066bfd6a1ea9d5dbfa5db9e25b66b8aa02 (diff)
Merge pull request #24385 from hpvb/reduce-string-coew
Reduce String CoW
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 3f017fa985..083a1eaed6 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -179,7 +179,7 @@ void String::copy_from_unchecked(const CharType *p_char, const int p_length) {
resize(p_length + 1);
set(p_length, 0);
- CharType *dst = &operator[](0);
+ CharType *dst = ptrw();
for (int i = 0; i < p_length; i++) {
dst[i] = p_char[i];
@@ -250,7 +250,7 @@ String &String::operator+=(const String &p_str) {
resize(length() + p_str.size());
const CharType *src = p_str.c_str();
- CharType *dst = &operator[](0);
+ CharType *dst = ptrw();
set(length(), 0);
@@ -289,7 +289,7 @@ String &String::operator+=(const char *p_str) {
resize(from + src_len + 1);
- CharType *dst = &operator[](0);
+ CharType *dst = ptrw();
set(length(), 0);
@@ -1431,7 +1431,7 @@ bool String::parse_utf8(const char *p_utf8, int p_len) {
}
resize(str_size + 1);
- CharType *dst = &operator[](0);
+ CharType *dst = ptrw();
dst[str_size] = 0;
while (cstr_size) {
@@ -3476,7 +3476,7 @@ String String::xml_unescape() const {
if (len == 0)
return String();
str.resize(len + 1);
- _xml_unescape(c_str(), l, &str[0]);
+ _xml_unescape(c_str(), l, str.ptrw());
str[len] = 0;
return str;
}