From b3f4e5cbe2d1ffa773fa725d34def3fd00341976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 14 May 2014 11:21:49 +0200 Subject: [PATCH] Use QString::splitRef in customtype example There is no need to allocate all these strings Change-Id: I398e1cc05bd3ad24df067a967a5e24fbc6d452ce Reviewed-by: Oswald Buddenhagen --- examples/tools/customtype/message.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/tools/customtype/message.cpp b/examples/tools/customtype/message.cpp index c470ab116e..eb8befc36f 100644 --- a/examples/tools/customtype/message.cpp +++ b/examples/tools/customtype/message.cpp @@ -65,7 +65,8 @@ Message::Message(const QString &body, const QStringList &headers) //! [custom type streaming operator] QDebug operator<<(QDebug dbg, const Message &message) { - QStringList pieces = message.body().split("\r\n", QString::SkipEmptyParts); + const QString body = message.body(); + QVector pieces = body.splitRef("\r\n", QString::SkipEmptyParts); if (pieces.isEmpty()) dbg.nospace() << "Message()"; else if (pieces.size() == 1)