path: root/tools
diff options
authorLuboš Luňák <>2019-09-13 15:13:55 +0200
committerLuboš Luňák <>2019-09-24 12:58:14 +0200
commit2f5f45921b05904a4be1ff633be09c62cb44ff08 (patch)
treeddd0cd5ef0349706f935d8360db88343347639a3 /tools
parenta7d40f575463467698df76f041e558cb3bea7c85 (diff)
support O(U)String::number() for fast string concatenation
When I did the fast string concatenation, I didn't add any support for number(), which simply returned a O(U)String, and so it did the extra allocation/deallocation, although that could be avoided. In order to support this, number() now returns a special temporary return type, similarly to O(U)StringConcat, which allows delaying the concatenation the same way. Also similarly, the change of the return type in some cases requires explicit cast to the actual string type. Usage of OString::getStr() is so extensive in the codebase that I actually added it to the helper class, after that it's only relatively few cases. Change-Id: Iba6e158010e1e458089698c426803052b6f46031 Reviewed-on: Tested-by: Jenkins Reviewed-by: Luboš Luňák <>
Diffstat (limited to 'tools')
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/qa/cppunit/test_xmlwalker.cxx b/tools/qa/cppunit/test_xmlwalker.cxx
index 4c2f9a808ea6..e06886deddd8 100644
--- a/tools/qa/cppunit/test_xmlwalker.cxx
+++ b/tools/qa/cppunit/test_xmlwalker.cxx
@@ -53,7 +53,8 @@ void XmlWalkerTest::testReadXML()
- CPPUNIT_ASSERT_EQUAL(OString::number(nNumberOfChildNodes), aWalker.attribute("number"));
+ CPPUNIT_ASSERT_EQUAL(OString(OString::number(nNumberOfChildNodes)),
+ aWalker.attribute("number"));
if (nNumberOfChildNodes == 1) // only the first node has the attribute
CPPUNIT_ASSERT_EQUAL(OString("123"), aWalker.attribute("attribute"));