Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.
authorRobin Burchell <robin+qt@viroteck.net>
Fri, 6 Apr 2012 14:34:19 +0000 (16:34 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 11 Apr 2012 08:46:19 +0000 (10:46 +0200)
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>
31 files changed:
src/corelib/global/qendian.h
src/corelib/global/qglobal.cpp
src/corelib/global/qglobal.h
src/corelib/global/qnumeric_p.h
src/corelib/kernel/qmetaobject.cpp
src/corelib/tools/qbytearraymatcher.cpp
src/corelib/tools/qstring.h
src/corelib/tools/qstringmatcher.cpp
src/corelib/tools/qvarlengtharray.h
src/corelib/tools/qvector.h
src/gui/accessible/qaccessible.h
src/gui/image/qpnghandler.cpp
src/gui/painting/qpainter.cpp
src/gui/text/qfontengine_qpa.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/text/qfontenginedirectwrite.cpp
src/gui/text/qglyphrun.cpp
src/gui/text/qrawfont.cpp
src/gui/text/qtextengine.cpp
src/network/access/qnetworkreplyimpl.cpp
src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
src/tools/moc/main.cpp
src/widgets/kernel/qgridlayout.cpp
tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
tests/baselineserver/shared/baselineprotocol.cpp
tests/benchmarks/corelib/tools/qvector/qrawvector.h

index e049fb6..4048eca 100644 (file)
@@ -79,7 +79,7 @@ template <typename T> inline void qbswap(const T src, uchar *dest)
 // If you want to avoid the memcopy, you must write specializations for this function
 template <typename T> inline void qToUnaligned(const T src, uchar *dest)
 {
-    qMemCopy(dest, &src, sizeof(T));
+    memcpy(dest, &src, sizeof(T));
 }
 
 /* T qFromLittleEndian(const uchar *src)
index 8125161..51849d7 100644 (file)
@@ -1964,13 +1964,6 @@ Q_CORE_EXPORT unsigned int qt_int_sqrt(unsigned int n)
     return p;
 }
 
-#if defined(qMemCopy)
-#  undef qMemCopy
-#endif
-#if defined(qMemSet)
-#  undef qMemSet
-#endif
-
 void *qMemCopy(void *dest, const void *src, size_t n) { return memcpy(dest, src, n); }
 void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); }
 
index ec7de3b..0648b08 100644 (file)
@@ -1189,12 +1189,12 @@ inline void qSwap(T &value1, T &value2)
 Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1);
 Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr);
 Q_CORE_EXPORT QT_DEPRECATED void *qRealloc(void *ptr, size_t size) Q_ALLOC_SIZE(2);
+Q_CORE_EXPORT QT_DEPRECATED void *qMemCopy(void *dest, const void *src, size_t n);
+Q_CORE_EXPORT QT_DEPRECATED void *qMemSet(void *dest, int c, size_t n);
 #endif
 Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1);
 Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment) Q_ALLOC_SIZE(2);
 Q_CORE_EXPORT void qFreeAligned(void *ptr);
-Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n);
-Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
 
 
 /*
@@ -1388,14 +1388,6 @@ inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase
 #  endif
 #endif
 
-#if 0
-/* tell gcc to use its built-in methods for some common functions */
-#if defined(QT_NO_DEBUG) && defined(Q_CC_GNU)
-#  define qMemCopy __builtin_memcpy
-#  define qMemSet __builtin_memset
-#endif
-#endif
-
 template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; }
 template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.data(); }
 
index 851c182..cc8e8d2 100644 (file)
@@ -100,7 +100,7 @@ static inline double qt_inf()
              : qt_le_inf_bytes);
 
     union { unsigned char c[8]; double d; } returnValue;
-    qMemCopy(returnValue.c, bytes, sizeof(returnValue.c));
+    memcpy(returnValue.c, bytes, sizeof(returnValue.c));
     return returnValue.d;
 }
 
@@ -115,7 +115,7 @@ static inline double qt_snan()
              : qt_le_snan_bytes);
 
     union { unsigned char c[8]; double d; } returnValue;
-    qMemCopy(returnValue.c, bytes, sizeof(returnValue.c));
+    memcpy(returnValue.c, bytes, sizeof(returnValue.c));
     return returnValue.d;
 }
 
@@ -130,7 +130,7 @@ static inline double qt_qnan()
              : qt_le_qnan_bytes);
 
     union { unsigned char c[8]; double d; } returnValue;
-    qMemCopy(returnValue.c, bytes, sizeof(returnValue.c));
+    memcpy(returnValue.c, bytes, sizeof(returnValue.c));
     return returnValue.d;
 }
 
index a93046d..e3b0b15 100644 (file)
@@ -1057,7 +1057,7 @@ QMetaProperty QMetaObject::property(int index) const
                 if (colon > enum_name) {
                     int len = colon-enum_name-1;
                     scope_buffer = (char *)malloc(len+1);
-                    qMemCopy(scope_buffer, enum_name, len);
+                    memcpy(scope_buffer, enum_name, len);
                     scope_buffer[len] = '\0';
                     scope_name = scope_buffer;
                     enum_name = colon+1;
index a635db0..c696021 100644 (file)
@@ -121,7 +121,7 @@ QByteArrayMatcher::QByteArrayMatcher()
 {
     p.p = 0;
     p.l = 0;
-    qMemSet(p.q_skiptable, 0, sizeof(p.q_skiptable));
+    memset(p.q_skiptable, 0, sizeof(p.q_skiptable));
 }
 
 /*!
index a902f5f..4936bce 100644 (file)
@@ -814,7 +814,7 @@ inline QString QString::section(QChar asep, int astart, int aend, SectionFlags a
 inline int QString::toWCharArray(wchar_t *array) const
 {
     if (sizeof(wchar_t) == sizeof(QChar)) {
-        qMemCopy(array, d->data(), sizeof(QChar) * size());
+        memcpy(array, d->data(), sizeof(QChar) * size());
         return size();
     }
     return toUcs4_helper(d->data(), size(), reinterpret_cast<uint *>(array));
index faab7a9..382d2e9 100644 (file)
@@ -151,7 +151,7 @@ static inline int bm_find(const ushort *uc, uint l, int index, const ushort *puc
 QStringMatcher::QStringMatcher()
     : d_ptr(0), q_cs(Qt::CaseSensitive)
 {
-    qMemSet(q_data, 0, sizeof(q_data));
+    memset(q_data, 0, sizeof(q_data));
 }
 
 /*!
index 6ce6573..639d246 100644 (file)
@@ -230,7 +230,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, in
         while (s < asize)
             new (ptr+(s++)) T(*abuf++);
     } else {
-        qMemCopy(&ptr[s], abuf, increment * sizeof(T));
+        memcpy(&ptr[s], abuf, increment * sizeof(T));
         s = asize;
     }
 }
@@ -268,7 +268,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a
                     QT_RETHROW;
                 }
             } else {
-                qMemCopy(ptr, oldPtr, copySize * sizeof(T));
+                memcpy(ptr, oldPtr, copySize * sizeof(T));
             }
         } else {
             ptr = oldPtr;
index 3c0db06..b36b832 100644 (file)
@@ -418,7 +418,7 @@ QVector<T>::QVector(int asize)
         while (i != b)
             new (--i) T;
     } else {
-        qMemSet(d->begin(), 0, asize * sizeof(T));
+        memset(d->begin(), 0, asize * sizeof(T));
     }
 }
 
@@ -546,7 +546,7 @@ void QVector<T>::realloc(int asize, int aalloc)
 
     } else if (asize > x->size) {
         // initialize newly allocated memory to 0
-        qMemSet(x->end(), 0, (asize - x->size) * sizeof(T));
+        memset(x->end(), 0, (asize - x->size) * sizeof(T));
     }
     x->size = asize;
 
index 91726f1..180ab61 100644 (file)
@@ -51,6 +51,8 @@
 #include <QtGui/qcolor.h>
 #include <QtGui/qevent.h>
 
+#include <stdlib.h>
+
 QT_BEGIN_HEADER
 
 QT_BEGIN_NAMESPACE
@@ -216,7 +218,7 @@ public:
         // quint64 alertHigh : 1;
 
         State() {
-            qMemSet(this, 0, sizeof(State));
+            memset(this, 0, sizeof(State));
         }
     };
 
index 7acad06..c3ae0a4 100644 (file)
@@ -184,7 +184,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz
     if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) {
         // Workaround for certain malformed PNGs that lack the final crc bytes
         uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 };
-        qMemCopy(data, endcrc, 4);
+        memcpy(data, endcrc, 4);
         in->seek(in->size());
         return;
     }
@@ -664,7 +664,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt
         return;
 
     png_textp text_ptr = new png_text[text.size()];
-    qMemSet(text_ptr, 0, text.size() * sizeof(png_text));
+    memset(text_ptr, 0, text.size() * sizeof(png_text));
 
     QMap<QString, QString>::ConstIterator it = text.constBegin();
     int i = 0;
index 8499551..97b0f91 100644 (file)
@@ -5594,9 +5594,9 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
         QVarLengthArray<QFixed, 128> advances(glyphCount);
         QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount);
         QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount);
-        qMemSet(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
-        qMemSet(advances.data(), 0, advances.size() * sizeof(QFixed));
-        qMemSet(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
+        memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
+        memset(advances.data(), 0, advances.size() * sizeof(QFixed));
+        memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
 
         textItem.glyphs.numGlyphs = glyphCount;
         textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray));
index d12e2d6..bf0cfd1 100644 (file)
@@ -612,7 +612,7 @@ void QPAGenerator::writeGMap()
     const int numBytes = glyphCount * sizeof(quint32);
     qint64 pos = buffer.size();
     buffer.resize(pos + numBytes);
-    qMemSet(buffer.data() + pos, 0xff, numBytes);
+    memset(buffer.data() + pos, 0xff, numBytes);
     dev->seek(pos + numBytes);
 }
 
index 64596eb..23f263b 100644 (file)
@@ -1120,7 +1120,7 @@ void QPFGenerator::writeGMap()
     const int numBytes = glyphCount * sizeof(quint32);
     qint64 pos = buffer.size();
     buffer.resize(pos + numBytes);
-    qMemSet(buffer.data() + pos, 0xff, numBytes);
+    memset(buffer.data() + pos, 0xff, numBytes);
     dev->seek(pos + numBytes);
 }
 
index 0f21ae8..4843d7f 100644 (file)
@@ -247,7 +247,7 @@ bool QFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, uint *len
                 return false;
             }
 
-            qMemCopy(buffer, tableData, tableSize);
+            memcpy(buffer, tableData, tableSize);
             m_directWriteFontFace->ReleaseFontTable(tableContext);
 
             return true;
@@ -597,7 +597,7 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t,
         int size = width * height * 3;
         if (size > 0) {
             BYTE *alphaValues = new BYTE[size];
-            qMemSet(alphaValues, size, 0);
+            memset(alphaValues, size, 0);
 
             hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1,
                                                    &rect,
index 813e0a8..673dd8f 100644 (file)
@@ -221,7 +221,7 @@ QVector<quint32> QGlyphRun::glyphIndexes() const
         return d->glyphIndexes;
     } else {
         QVector<quint32> indexes(d->glyphIndexDataSize);
-        qMemCopy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
+        memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
         return indexes;
     }
 }
@@ -247,7 +247,7 @@ QVector<QPointF> QGlyphRun::positions() const
         return d->glyphPositions;
     } else {
         QVector<QPointF> glyphPositions(d->glyphPositionDataSize);
-        qMemCopy(glyphPositions.data(), d->glyphPositionData,
+        memcpy(glyphPositions.data(), d->glyphPositionData,
                  d->glyphPositionDataSize * sizeof(QPointF));
         return glyphPositions;
     }
index 5cdd563..3bd4d88 100644 (file)
@@ -504,7 +504,7 @@ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyph
 
     int numGlyphs = glyphIndexes.size();
     QVarLengthGlyphLayoutArray glyphs(numGlyphs);
-    qMemCopy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32));
+    memcpy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32));
 
     d->fontEngine->recalcAdvances(&glyphs, 0);
 
index 7d36627..c5c6b2e 100644 (file)
@@ -1000,7 +1000,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
         kerningEnabled = this->font(si).d->kerning;
 
     HB_ShaperItem entire_shaper_item;
-    qMemSet(&entire_shaper_item, 0, sizeof(entire_shaper_item));
+    memset(&entire_shaper_item, 0, sizeof(entire_shaper_item));
     entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData());
     entire_shaper_item.stringLength = layoutData->string.length();
     entire_shaper_item.item.script = (HB_Script)si.analysis.script;
index c0b8acc..c65d790 100644 (file)
@@ -973,7 +973,7 @@ qint64 QNetworkReplyImpl::readData(char *data, qint64 maxlen)
         if (maxAvail == 0)
             return d->state == QNetworkReplyImplPrivate::Finished ? -1 : 0;
         // FIXME what about "Aborted" state?
-        qMemCopy(data, d->downloadBuffer + d->downloadBufferReadPosition, maxAvail);
+        memcpy(data, d->downloadBuffer + d->downloadBufferReadPosition, maxAvail);
         d->downloadBufferReadPosition += maxAvail;
         return maxAvail;
     }
index 1239f3d..9621846 100644 (file)
@@ -850,7 +850,7 @@ int QWindowsNativeFileDialogBase::itemPaths(IShellItemArray *items,
 static inline void toBuffer(const QString &what, WCHAR **ptr)
 {
     const int length = 1 + what.size();
-    qMemCopy(*ptr, what.utf16(), length * sizeof(WCHAR));
+    memcpy(*ptr, what.utf16(), length * sizeof(WCHAR));
     *ptr += length;
 }
 
index 82410bf..c8906bd 100644 (file)
@@ -275,7 +275,7 @@ bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, ui
                 return false;
             }
 
-            qMemCopy(buffer, tableData, tableSize);
+            memcpy(buffer, tableData, tableSize);
             m_directWriteFontFace->ReleaseFontTable(tableContext);
 
             return true;
@@ -570,7 +570,7 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
 
         int size = width * height * 3;
         BYTE *alphaValues = new BYTE[size];
-        qMemSet(alphaValues, size, 0);
+        memset(alphaValues, size, 0);
 
         hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1,
                                                &rect,
index 6f67a7d..5e87632 100644 (file)
@@ -143,7 +143,7 @@ QByteArray composePreprocessorOutput(const Symbols &symbols) {
         const int padding = sym.lineNum - lineNum;
         if (padding > 0) {
             output.resize(output.size() + padding);
-            qMemSet(output.data() + output.size() - padding, '\n', padding);
+            memset(output.data() + output.size() - padding, '\n', padding);
             lineNum = sym.lineNum;
         }
 
index 39daf96..c81158e 100644 (file)
@@ -779,7 +779,7 @@ void QGridLayoutPrivate::setupLayoutData(int hSpacing, int vSpacing)
         adjacent to which and compute the spacings correctly.
     */
     QVarLengthArray<QGridBox *> grid(rr * cc);
-    qMemSet(grid.data(), 0, rr * cc * sizeof(QGridBox *));
+    memset(grid.data(), 0, rr * cc * sizeof(QGridBox *));
 
     /*
         Initialize 'sizes' and 'grid' data structures, and insert
index c6ccc93..0cafc1d 100644 (file)
@@ -402,7 +402,7 @@ public:
         if (readSize < 0)
             return -1;
 
-        qMemCopy(data, openFile_->content.constData() + position_, readSize);
+        memcpy(data, openFile_->content.constData() + position_, readSize);
         position_ += readSize;
 
         return readSize;
index b779305..037893a 100644 (file)
@@ -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
 }
index 932d652..827fa36 100644 (file)
@@ -112,7 +112,7 @@ static void initializePadding(QImage *image)
     if (paddingBytes == 0)
         return;
     for (int y = 0; y < image->height(); ++y) {
-        qMemSet(image->scanLine(y) + effectiveBytesPerLine, 0, paddingBytes);
+        memset(image->scanLine(y) + effectiveBytesPerLine, 0, paddingBytes);
     }
 }
 
@@ -454,7 +454,7 @@ void tst_QImageWriter::saveWithNoFormat()
     SKIP_IF_UNSUPPORTED(format);
 
     QImage niceImage(64, 64, QImage::Format_ARGB32);
-    qMemSet(niceImage.bits(), 0, niceImage.byteCount());
+    memset(niceImage.bits(), 0, niceImage.byteCount());
 
     QImageWriter writer(fileName /* , 0 - no format! */);
     if (error != 0) {
index 5eaf8b1..47c4003 100644 (file)
@@ -400,7 +400,7 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
         if (initial_files.at(i)[0] == '.') {
             QString hiddenFile = QDir::toNativeSeparators(file.fileName());
             wchar_t nativeHiddenFile[MAX_PATH];
-            qMemSet(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
+            memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
             hiddenFile.toWCharArray(nativeHiddenFile);
             DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile);
             if (currentAttributes == 0xFFFFFFFF) {
index 2ee166c..f9610fa 100644 (file)
@@ -885,7 +885,7 @@ void tst_QItemDelegate::decoration()
     }
     case QVariant::Image: {
         QImage img(size, QImage::Format_Mono);
-        qMemSet(img.bits(), 0, img.byteCount());
+        memset(img.bits(), 0, img.byteCount());
         value = img;
         break;
     }
index 9fcd995..a687c8d 100644 (file)
@@ -232,7 +232,7 @@ quint64 ImageItem::computeChecksum(const QImage &image)
         uchar *p = img.bits() + bpl - padBytes;
         const int h = img.height();
         for (int y = 0; y < h; ++y) {
-            qMemSet(p, 0, padBytes);
+            memset(p, 0, padBytes);
             p += bpl;
         }
     }
index 8c2d014..18d9847 100644 (file)
@@ -379,7 +379,7 @@ QRawVector<T>::QRawVector(int asize)
         while (i != b)
             new (--i) T;
     } else {
-        qMemSet(m_begin, 0, asize * sizeof(T));
+        memset(m_begin, 0, asize * sizeof(T));
     }
 }
 
@@ -474,7 +474,7 @@ void QRawVector<T>::realloc(int asize, int aalloc, bool ref)
 
     } else if (asize > xsize) {
         // initialize newly allocated memory to 0
-        qMemSet(xbegin + xsize, 0, (asize - xsize) * sizeof(T));
+        memset(xbegin + xsize, 0, (asize - xsize) * sizeof(T));
     }
     xsize = asize;