diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-15 07:02:23 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-17 00:20:50 (GMT) |
commit | 48f89845732b2bf6b9e7a6dbe98efd6dfd5e3cff (patch) | |
tree | f48c0722c6c946145eac3b1f1877c219e1ddd277 /src | |
parent | 26cd94ef47ffc969dc835e98b58eded14e669964 (diff) | |
download | Qt-48f89845732b2bf6b9e7a6dbe98efd6dfd5e3cff.zip Qt-48f89845732b2bf6b9e7a6dbe98efd6dfd5e3cff.tar.gz Qt-48f89845732b2bf6b9e7a6dbe98efd6dfd5e3cff.tar.bz2 |
Optimization: Don't unnecessarily run VMEStack element constructors
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativevme_p.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativevme_p.h b/src/declarative/qml/qdeclarativevme_p.h index 3f8aa15..1c6fd3c 100644 --- a/src/declarative/qml/qdeclarativevme_p.h +++ b/src/declarative/qml/qdeclarativevme_p.h @@ -70,8 +70,8 @@ class QDeclarativeContextData; template<typename T, int N = 128> class QDeclarativeVMEStack { public: - QDeclarativeVMEStack() : index(-1), maxSize(N), data(fixedData) {} - ~QDeclarativeVMEStack() { if (data != fixedData) qFree(data); } + QDeclarativeVMEStack() : index(-1), maxSize(N), data((T *)fixedData) {} + ~QDeclarativeVMEStack() { if (data != (T *)fixedData) qFree(data); } bool isEmpty() const { return index == -1; } const T &top() const { return data[index]; } @@ -83,7 +83,7 @@ public: private: void realloc() { maxSize += N; - if (data != fixedData) { + if (data != (T *)fixedData) { data = (T*)qRealloc(data, maxSize * sizeof(T)); } else { data = (T*)qMalloc(maxSize * sizeof(T)); @@ -92,7 +92,7 @@ private: int index; int maxSize; T *data; - T fixedData[N]; + char fixedData[N * sizeof(T)]; }; class QDeclarativeVME |