From 14567c5eb05b6dd7ba9706a605c8d3ee8c5d8742 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Mon, 29 Aug 2011 22:35:29 +0200 Subject: Factor vector reserve code in runtime into its own function --- src/rt/rust_builtin.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/rt/rust_builtin.cpp') diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index a8929677aff..049fe71384e 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -225,13 +225,7 @@ str_from_vec(rust_task *task, rust_vec **vp) extern "C" CDECL void vec_reserve_shared(rust_task* task, type_desc* ty, rust_vec** vp, size_t n_elts) { - size_t new_sz = n_elts * ty->size; - if (new_sz > (*vp)->alloc) { - size_t new_alloc = next_power_of_two(new_sz); - *vp = (rust_vec*)task->kernel->realloc(*vp, new_alloc + - sizeof(rust_vec)); - (*vp)->alloc = new_alloc; - } + reserve_vec(task, vp, n_elts * ty->size); } /** -- cgit 1.4.1-3-g733a5