diff options
author | W. J. van der Laan <laanwj@protonmail.com> | 2021-05-26 15:01:14 +0200 |
---|---|---|
committer | W. J. van der Laan <laanwj@protonmail.com> | 2021-05-26 15:01:18 +0200 |
commit | 456c8d6cd80fc3461957a3553a0483756396b988 (patch) | |
tree | 85349bee04765f2c871f8c59027c5aaca7d205b7 /src/qt/bitcoin.cpp | |
parent | ecddd1248258fb904ba88b5255ecbc624eec4f37 (diff) | |
parent | a02c970eb001b456d74ddc30750fe8b55348ddac (diff) |
Merge bitcoin-core/gui#313: qt: Optimize string concatenation by default
a02c970eb001b456d74ddc30750fe8b55348ddac qt, refactor: Revert explicit including QStringBuilder (Hennadii Stepanov)
3fd3a0fc87a81d42755246830124833e9ca3f0a9 qt, build: Optimize string concatenation (Hennadii Stepanov)
Pull request description:
From [Qt docs](https://doc.qt.io/qt-5/qstring.html#more-efficient-string-construction):
> ... multiple uses of the \[`QString`\] '+' operator usually means multiple memory allocations. When concatenating n substrings, where n > 2, there can be as many as n - 1 calls to the memory allocator.
With this PR
> ... the '+' will automatically be performed as the `QStringBuilder` '%' everywhere.
The change in the `src/Makefile.qt.include` file does not justify submitting this PR into the main repo, IMHO.
ACKs for top commit:
laanwj:
Code review ACK a02c970eb001b456d74ddc30750fe8b55348ddac
Talkless:
utACK a02c970eb001b456d74ddc30750fe8b55348ddac, built successfully on Debian Sid with Qt 5.15.2, but did not check if any displayed strings are "wrong" after refactoring.
jarolrod:
ACK a02c970eb001b456d74ddc30750fe8b55348ddac
Tree-SHA512: cbb476ee96f27c3bd6e125efab74d8bf24bbdb4c30576b3feea45e203405f3bf5b497dd7d3e11361fc825fcbf4b893b152921a9efdeaf73b42d1865d85f0ae84
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r-- | src/qt/bitcoin.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index dffdd5158b..69948402d0 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -50,7 +50,6 @@ #include <QLocale> #include <QMessageBox> #include <QSettings> -#include <QStringBuilder> #include <QThread> #include <QTimer> #include <QTranslator> @@ -419,8 +418,8 @@ void BitcoinApplication::handleRunawayException(const QString &message) { QMessageBox::critical( nullptr, tr("Runaway exception"), - tr("A fatal error occurred. %1 can no longer continue safely and will quit.").arg(PACKAGE_NAME) % - QLatin1String("<br><br>") % GUIUtil::MakeHtmlLink(message, PACKAGE_BUGREPORT)); + tr("A fatal error occurred. %1 can no longer continue safely and will quit.").arg(PACKAGE_NAME) + + QLatin1String("<br><br>") + GUIUtil::MakeHtmlLink(message, PACKAGE_BUGREPORT)); ::exit(EXIT_FAILURE); } @@ -430,8 +429,8 @@ void BitcoinApplication::handleNonFatalException(const QString& message) QMessageBox::warning( nullptr, tr("Internal error"), tr("An internal error occurred. %1 will attempt to continue safely. This is " - "an unexpected bug which can be reported as described below.").arg(PACKAGE_NAME) % - QLatin1String("<br><br>") % GUIUtil::MakeHtmlLink(message, PACKAGE_BUGREPORT)); + "an unexpected bug which can be reported as described below.").arg(PACKAGE_NAME) + + QLatin1String("<br><br>") + GUIUtil::MakeHtmlLink(message, PACKAGE_BUGREPORT)); } WId BitcoinApplication::getMainWinId() const |