From b24fece481a3bfde6a4ce86f5f0425101ac9294b Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Tue, 9 Dec 2014 13:14:03 +0100 Subject: [PATCH] Prevent repetitive temporary allocation of strings. This data is static, and should be declared such. Doing so gets rid of thousands of temporary allocations. REVIEW: 121405 --- akonadi/collectionrightsattribute.cpp | 3 +-- kpimutils/linklocator.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/akonadi/collectionrightsattribute.cpp b/akonadi/collectionrightsattribute.cpp index 21b364645..1ab5594dc 100644 --- a/akonadi/collectionrightsattribute.cpp +++ b/akonadi/collectionrightsattribute.cpp @@ -21,8 +21,6 @@ using namespace Akonadi; -static const char *s_accessRightsIdentifier = "AccessRights"; - static Collection::Rights dataToRights(const QByteArray &data) { Collection::Rights rights = Collection::ReadOnly; @@ -142,6 +140,7 @@ CollectionRightsAttribute *CollectionRightsAttribute::clone() const QByteArray CollectionRightsAttribute::type() const { + static const QByteArray s_accessRightsIdentifier("AccessRights"); return s_accessRightsIdentifier; } diff --git a/kpimutils/linklocator.cpp b/kpimutils/linklocator.cpp index 3e6c3221a..f5d9afd45 100644 --- a/kpimutils/linklocator.cpp +++ b/kpimutils/linklocator.cpp @@ -177,7 +177,7 @@ bool LinkLocator::atUrl() const { // the following characters are allowed in a dot-atom (RFC 2822): // a-z A-Z 0-9 . ! # $ % & ' * + - / = ? ^ _ ` { | } ~ - const QString allowedSpecialChars = QLatin1String( ".!#$%&'*+-/=?^_`{|}~" ); + static const QString allowedSpecialChars = QLatin1String( ".!#$%&'*+-/=?^_`{|}~" ); // the character directly before the URL must not be a letter, a number or // any other character allowed in a dot-atom (RFC 2822). @@ -229,7 +229,7 @@ QString LinkLocator::getEmailAddress() if ( mText[mPos] == QLatin1Char('@') ) { // the following characters are allowed in a dot-atom (RFC 2822): // a-z A-Z 0-9 . ! # $ % & ' * + - / = ? ^ _ ` { | } ~ - const QString allowedSpecialChars = QLatin1String( ".!#$%&'*+-/=?^_`{|}~" ); + static const QString allowedSpecialChars = QLatin1String( ".!#$%&'*+-/=?^_`{|}~" ); // determine the local part of the email address int start = mPos - 1; -- GitLab