Create some infrastructure for building up @-vectors. Work on #2921.

This commit is contained in:
Michael Sullivan
2012-07-17 16:31:19 -07:00
parent 8e6d66280f
commit aa5b5ab886
9 changed files with 295 additions and 14 deletions

View File

@@ -62,6 +62,16 @@ vec_data(rust_vec *v) {
return reinterpret_cast<T*>(v->data);
}
inline void reserve_vec_exact_shared(rust_task* task, rust_vec_box** vpp,
size_t size) {
rust_opaque_box** ovpp = (rust_opaque_box**)vpp;
if (size > (*vpp)->body.alloc) {
*vpp = (rust_vec_box*)task->boxed.realloc(
*ovpp, size + sizeof(rust_vec));
(*vpp)->body.alloc = size;
}
}
inline void reserve_vec_exact(rust_task* task, rust_vec_box** vpp,
size_t size) {
if (size > (*vpp)->body.alloc) {