summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2022-12-17 11:43:14 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-12-19 20:37:05 +0000
commit348911a4e7e3ded28fd1f73a8270e48198e131f9 (patch)
treec07a12bfcb9739e9b877da458a9a7008a2386261
parentff83fc75901527c0c14c481dbe9929129942c5b9 (diff)
RCCFileInfo: use QString prepend optimization
Instead of using QStringBuilder (which always allocates a new QString to hold the result of the concatenation), reuse the existing QString, and use prepend which will typically have allocated extra space, reducing the chances it will reallocate. Change-Id: Ic4ef775246db58e56152a6ede1a75f7621950dd9 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r--src/tools/rcc/rcc.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 3b5166a70e..3331ffbb9d 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -142,7 +142,8 @@ QString RCCFileInfo::resourceName() const
QString resource = m_name;
for (RCCFileInfo *p = m_parent; p; p = p->m_parent)
resource = resource.prepend(p->m_name + u'/');
- return u':' + resource;
+ resource.prepend(u':');
+ return resource;
}
void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)