remove headers from unique vectors

This commit is contained in:
Daniel Micay
2013-07-15 14:23:42 -04:00
parent 04f9ce0ae3
commit e118555ce6
18 changed files with 230 additions and 136 deletions

View File

@@ -57,17 +57,17 @@ vec_data(rust_vec *v) {
return reinterpret_cast<T*>(v->data);
}
inline void reserve_vec_exact(rust_vec_box** vpp,
inline void reserve_vec_exact(rust_vec** vpp,
size_t size) {
if (size > (*vpp)->body.alloc) {
if (size > (*vpp)->alloc) {
rust_exchange_alloc exchange_alloc;
*vpp = (rust_vec_box*)exchange_alloc
.realloc(*vpp, size + sizeof(rust_vec_box));
(*vpp)->body.alloc = size;
*vpp = (rust_vec*)exchange_alloc
.realloc(*vpp, size + sizeof(rust_vec));
(*vpp)->alloc = size;
}
}
typedef rust_vec_box rust_str;
typedef rust_vec rust_str;
inline size_t get_box_size(size_t body_size, size_t body_align) {
size_t header_size = sizeof(rust_opaque_box);