summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-01-11 14:46:20 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-01-14 12:48:16 +0000
commited45af5f3c01b9094a075f17c39c784926e29034 (patch)
tree87ea8351273df0dad37271399151a1da27d4f8d6
parenta836b4735c9e3cea9ba3129c9d2fb7d63b01ebc9 (diff)
QXcbXSettings: don't construct a QByteArray just to append it
... use QByteArray::append(char*,int) instead. Also cache the return value of the out-of-line function xcb_get_property_value_length(). Saves ~120b in text size, and a heap allocation. Change-Id: I4d1deafdcd3345f2b7dfbf8c45702cfee733a269 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
-rw-r--r--src/plugins/platforms/xcb/qxcbxsettings.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp
index f143d6e8bb..73805921af 100644
--- a/src/plugins/platforms/xcb/qxcbxsettings.cpp
+++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp
@@ -117,8 +117,9 @@ public:
if (!reply)
return settings;
- settings += QByteArray((const char *)xcb_get_property_value(reply), xcb_get_property_value_length(reply));
- offset += xcb_get_property_value_length(reply);
+ const auto property_value_length = xcb_get_property_value_length(reply);
+ settings.append(static_cast<const char *>(xcb_get_property_value(reply)), property_value_length);
+ offset += property_value_length;
more = reply->bytes_after != 0;
free(reply);