зеркало из https://github.com/mozilla/pjs.git
Fix Windows optimized bustage from bug 636039 patch 15: use placement new in a loop instead of using placement new[].
This commit is contained in:
Родитель
92673c9bcd
Коммит
5970f11790
|
@ -1716,8 +1716,13 @@ struct AutoCSSValueArray {
|
|||
AutoCSSValueArray(void* aStorage, size_t aCount) {
|
||||
NS_ABORT_IF_FALSE(size_t(aStorage) % NS_ALIGNMENT_OF(nsCSSValue) == 0,
|
||||
"bad alignment from alloca");
|
||||
mArray = new (aStorage) nsCSSValue[aCount];
|
||||
mCount = aCount;
|
||||
// Don't use placement new[], since it might store extra data
|
||||
// for the count (on Windows!).
|
||||
mArray = static_cast<nsCSSValue*>(aStorage);
|
||||
for (size_t i = 0; i < mCount; ++i) {
|
||||
new (mArray + i) nsCSSValue();
|
||||
}
|
||||
}
|
||||
|
||||
~AutoCSSValueArray() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче