aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativecompileddata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qdeclarativecompileddata.cpp')
-rw-r--r--src/declarative/qml/qdeclarativecompileddata.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp
index da7c3fea7b..c59dd78d53 100644
--- a/src/declarative/qml/qdeclarativecompileddata.cpp
+++ b/src/declarative/qml/qdeclarativecompileddata.cpp
@@ -100,6 +100,7 @@ int QDeclarativeCompiledData::indexForUrl(const QUrl &data)
QDeclarativeCompiledData::QDeclarativeCompiledData(QDeclarativeEngine *engine)
: QDeclarativeCleanup(engine), importCache(0), root(0), rootPropertyCache(0)
{
+ bytecode.reserve(1024);
}
QDeclarativeCompiledData::~QDeclarativeCompiledData()
@@ -202,10 +203,9 @@ int QDeclarativeCompiledData::addInstruction(const QDeclarativeInstruction &inst
{
int ptrOffset = bytecode.size();
int size = instr.size();
- bytecode.resize(bytecode.size() + size);
- char *data = bytecode.data() + ptrOffset;
- qMemCopy(data, &instr, size);
-
+ if (bytecode.capacity() <= bytecode.size() + size)
+ bytecode.reserve(bytecode.size() + size + 512);
+ bytecode.append(reinterpret_cast<const char *>(&instr), size);
return ptrOffset;
}