summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2012-04-06 16:34:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-11 10:46:19 +0200
commit7be255156feb7636a5cca5c4fe78f42879ffe69b (patch)
tree0255287041af5b79cb437e7d9003cd4c9a179dfc /tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
parent5dc506ad841685c8404c085bd8cf9c5442518897 (diff)
Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.
Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp')
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index b7793051b1..037893a13e 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -622,7 +622,7 @@ void tst_QByteArray::fromBase64()
void tst_QByteArray::qvsnprintf()
{
char buf[20];
- qMemSet(buf, 42, sizeof(buf));
+ memset(buf, 42, sizeof(buf));
QCOMPARE(::qsnprintf(buf, 10, "%s", "bubu"), 4);
QCOMPARE(static_cast<const char *>(buf), "bubu");
@@ -631,12 +631,12 @@ void tst_QByteArray::qvsnprintf()
QCOMPARE(buf[5], char(42));
#endif
- qMemSet(buf, 42, sizeof(buf));
+ memset(buf, 42, sizeof(buf));
QCOMPARE(::qsnprintf(buf, 5, "%s", "bubu"), 4);
QCOMPARE(static_cast<const char *>(buf), "bubu");
QCOMPARE(buf[5], char(42));
- qMemSet(buf, 42, sizeof(buf));
+ memset(buf, 42, sizeof(buf));
#ifdef Q_OS_WIN
// VS 2005 uses the Qt implementation of vsnprintf.
# if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
@@ -661,7 +661,7 @@ void tst_QByteArray::qvsnprintf()
QCOMPARE(buf[4], char(42));
#ifndef Q_OS_WIN
- qMemSet(buf, 42, sizeof(buf));
+ memset(buf, 42, sizeof(buf));
QCOMPARE(::qsnprintf(buf, 10, ""), 0);
#endif
}