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:
commit de
Sara Golemon
pai
7fbef94637
commit
2baabea1ae
@@ -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, ...) {
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário