new considered harmful

I'm committing my work on HphpArray in bite-sized pieces for easier review. This piece replaces calls to NEW with a factory method. There are many problems with operator new, starting with the fact that the allocator cannot communicate properly with the constructor.

The newly introduced factory method should return ArrayData but that causes many issues right now, so I left that step to a future diff.
Esse commit está contido em:
Andrei Alexandrescu
2013-05-15 20:17:44 -07:00
commit de Sara Golemon
commit 2baabea1ae
19 arquivos alterados com 49 adições e 35 exclusões
+3 -3
Ver Arquivo
@@ -30,18 +30,18 @@ ArrayInit::ArrayInit(ssize_t n) {
// Force compilation of ArrayShell
m_data = NEW(ArrayShell)(n);
} else {
m_data = NEW(HphpArray)(n);
m_data = ArrayData::Make(n);
}
}
HOT_FUNC
ArrayData *ArrayInit::CreateVector(ssize_t n) {
return NEW(HphpArray)(n);
return ArrayData::Make(n);
}
HOT_FUNC
ArrayData *ArrayInit::CreateMap(ssize_t n) {
return NEW(HphpArray)(n);
return ArrayData::Make(n);
}
ArrayData *ArrayInit::CreateParams(int count, ...) {