diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-12 15:33:21 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-25 14:34:31 +0000 |
commit | 1aa382f08aadb0d4392b139204cb88df3685ab7e (patch) | |
tree | b63a75c0e79dfbdd06491b0ebe09d970475d1fc4 /src/utils/stringutils.cpp | |
parent | f00022aa66f7b7c6d0825b8a45944e35d8cb0cf6 (diff) | |
download | mana-1aa382f08aadb0d4392b139204cb88df3685ab7e.tar.gz mana-1aa382f08aadb0d4392b139204cb88df3685ab7e.tar.bz2 mana-1aa382f08aadb0d4392b139204cb88df3685ab7e.tar.xz mana-1aa382f08aadb0d4392b139204cb88df3685ab7e.zip |
Avoid string allocations during text rendering and sizing
Now a text chunk has a maximum length of 4k characters, but that should
be plenty of space since they're only single lines.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 7a951ec6..d9c65dd7 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -28,8 +28,6 @@ #include <cstdarg> #include <cstdio> -static int UTF8_MAX_SIZE = 10; - std::string &trim(std::string &str) { std::string::size_type pos = str.find_last_not_of(' '); @@ -170,14 +168,6 @@ std::string findSameSubstring(const std::string &str1, return str1.substr(0, minLength); } -const char *getSafeUtf8String(const std::string &text) -{ - char *buf = new char[text.size() + UTF8_MAX_SIZE]; - memcpy(buf, text.c_str(), text.size()); - memset(buf + text.size(), 0, UTF8_MAX_SIZE); - return buf; -} - bool getBoolFromString(const std::string &text, bool def) { std::string a = text; |