diff options
author | Tsuda Kageyu <tsuda.kageyu@gmail.com> | 2017-01-28 01:17:21 +0900 |
---|---|---|
committer | Tsuda Kageyu <tsuda.kageyu@gmail.com> | 2017-01-28 01:17:21 +0900 |
commit | 922fd611ae20e4ba9423c2b46a70513979946a20 (patch) | |
tree | c207648a0319f455910abb40f3ff8c455422a3bc /taglib/toolkit | |
parent | 3d14ff74b1926693c9b18bbb7afa75f7461b8d2b (diff) |
Reduce useless memory reallocation in String::upper().
Diffstat (limited to 'taglib/toolkit')
-rw-r--r-- | taglib/toolkit/tstring.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp index bee4fb7e..863bbf59 100644 --- a/taglib/toolkit/tstring.cpp +++ b/taglib/toolkit/tstring.cpp @@ -469,12 +469,11 @@ String & String::clear() String String::upper() const { String s; - - static int shift = 'A' - 'a'; + s.d->data.reserve(size()); for(ConstIterator it = begin(); it != end(); ++it) { if(*it >= 'a' && *it <= 'z') - s.d->data.push_back(*it + shift); + s.d->data.push_back(*it + 'A' - 'a'); else s.d->data.push_back(*it); } |