From ed45af5f3c01b9094a075f17c39c784926e29034 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 11 Jan 2016 14:46:20 +0100 Subject: 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) --- src/plugins/platforms/xcb/qxcbxsettings.cpp | 5 +++-- 1 file 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(xcb_get_property_value(reply)), property_value_length); + offset += property_value_length; more = reply->bytes_after != 0; free(reply); -- cgit v1.2.3