summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qresource.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-02-06 19:41:46 -0800
committerThiago Macieira <thiago.macieira@intel.com>2017-02-09 01:22:12 +0000
commit4f3ea309222bf9af61f721b39265b651ab297914 (patch)
tree4c93f29e2e58d23a34d0037826e753175b5c3315 /src/corelib/io/qresource.cpp
parent6c8aabbe5232314916084e4a1eaec6e9f03494a2 (diff)
Avoid unnecessary creation of some Q_GLOBAL_STATIC
If these lists weren't created in the first place, then they are empty. We don't need to create it in order to conclude that. Unlike most Q_GLOBAL_STATICS, these are almost never used and yet they were always created due to where they were checked. Since we're calling exists() before, there are two consequences: first, since the list already exists, we're not allocating memory so it cannot throw std::bad_alloc when being accessed. Second, since we've just checked it exists, we can use QGlobalStatic's operator*(), which is slightly faster than operator()(). The weird &(*list) syntax is only to avoid changing the rest of the code that used a pointer Change-Id: Ifaee7464122d402991b6fffd14a0e44f533dc3d9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/io/qresource.cpp')
0 files changed, 0 insertions, 0 deletions