summaryrefslogtreecommitdiffstats
path: root/header.GPL
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-02-23 22:12:20 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-02-24 17:14:25 +0000
commitaca859cbc4c599e0c996dd2f3df148d59e3f590a (patch)
treede541d53d1ce3a291d576adca9ff0361fae25a98 /header.GPL
parenta4dee8e274f00a65bdd3ad706db6c39d4a82759d (diff)
QMimeTypeParser: don't use the heap to create QMimeMagicRules
The function createMagicMatchRule() returned a heap-allocated QMimeMagicRule, and the caller code did not check the return value for nullptr, but copied the rule into a container before deleting the original again. Fix by returning by-value instead. Every C++ compiler will use RVO for this. On top, add an optimistic std::move() when inserting the rule into the container (currently QList, so no rvalue-push_back, yet). While touching the return value, also remove an unholy out-parameter with just local effects by returning a Result struct instead. The rest of the code remains full of out- parameters, of course. Add one Q_UNLIKELY and two qUtf16Printable() as drive-bys. Saves ~300b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I4374ab41f38502cd5c64ac37d106ca4bc6e00327 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'header.GPL')
0 files changed, 0 insertions, 0 deletions