diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2012-08-25 16:53:44 -0700 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2012-08-30 20:40:52 -0700 |
| commit | 0e1a4a4da29caadba5d5cd86a5cd2587fdb0755d (patch) | |
| tree | 2f810735541c4c8c3b74070a1f733617e6a2845e /src/rt | |
| parent | 536cb90a216a08870fbaac6aad93f77f0681537d (diff) | |
| download | rust-0e1a4a4da29caadba5d5cd86a5cd2587fdb0755d.tar.gz rust-0e1a4a4da29caadba5d5cd86a5cd2587fdb0755d.zip | |
libcore: rewrite vec::unsafe::from_buf in pure rust
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 19 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 1 |
2 files changed, 2 insertions, 18 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index cabc086b64f..a74f5985d36 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -148,22 +148,6 @@ str_reserve_shared(rust_vec_box** sp, reserve_vec_exact(task, sp, n_elts + 1); } -/** - * Copies elements in an unsafe buffer to the given interior vector. The - * vector must have size zero. - */ -extern "C" CDECL rust_vec_box* -vec_from_buf_shared(type_desc *ty, void *ptr, size_t count) { - rust_task *task = rust_get_current_task(); - size_t fill = ty->size * count; - rust_vec_box* v = (rust_vec_box*) - task->kernel->malloc(fill + sizeof(rust_vec_box), - "vec_from_buf"); - v->body.fill = v->body.alloc = fill; - memmove(&v->body.data[0], ptr, fill); - return v; -} - extern "C" CDECL void rust_str_push(rust_vec_box** sp, uint8_t byte) { rust_task *task = rust_get_current_task(); @@ -515,8 +499,9 @@ void tm_to_rust_tm(tm* in_tm, rust_tm* out_tm, int32_t gmtoff, out_tm->tm_nsec = nsec; if (zone != NULL) { + rust_task *task = rust_get_current_task(); size_t size = strlen(zone); - str_reserve_shared(&out_tm->tm_zone, size); + reserve_vec_exact(task, &out_tm->tm_zone, size + 1); memcpy(out_tm->tm_zone->body.data, zone, size); out_tm->tm_zone->body.fill = size + 1; out_tm->tm_zone->body.data[size] = '\0'; diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index b4db45ab3a0..141937356e6 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -63,7 +63,6 @@ start_task vec_reserve_shared_actual vec_reserve_shared str_reserve_shared -vec_from_buf_shared task_clear_event_reject task_wait_event task_signal_event |
