expose Vector->reserve(size) to php space

example usage: genv() takes a Vector of Awaitable and creates a
Vector of WaitHandles. resize() requires a default value, reserve allows us to hint proper allocation.
Esse commit está contido em:
bill fumerola
2013-06-10 11:25:49 -07:00
commit de Sara Golemon
commit 8b80373f17
3 arquivos alterados com 31 adições e 0 exclusões
+15
Ver Arquivo
@@ -256,6 +256,21 @@ void c_Vector::t_resize(CVarRef sz, CVarRef value) {
resize(intSz, val);
}
void c_Vector::t_reserve(CVarRef sz) {
if (!sz.isInteger()) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Parameter sz must be a non-negative integer"));
throw e;
}
int64_t intSz = sz.toInt64();
if (intSz < 0) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Parameter sz must be a non-negative integer"));
throw e;
}
reserve(intSz);
}
Object c_Vector::t_clear() {
++m_version;
uint sz = m_size;
+1
Ver Arquivo
@@ -46,6 +46,7 @@ class c_Vector : public ExtObjectDataFlags<ObjectData::VectorAttrInit|
Object t_append(CVarRef val); // deprecated
Variant t_pop();
void t_resize(CVarRef sz, CVarRef value);
void t_reserve(CVarRef sz);
Object t_clear();
bool t_isempty();
int64_t t_count();
+15
Ver Arquivo
@@ -331,6 +331,21 @@
}
]
},
{
"name": "reserve",
"flags": [
"HasDocComment"
],
"return": {
"type": null
},
"args": [
{
"name": "sz",
"type": "Variant"
}
]
},
{
"name": "toArray",
"flags": [