rt: Fix rust_list_files for new vecs

This commit is contained in:
Brian Anderson 2012-05-22 18:00:56 -07:00
parent 54d42c4d74
commit ecd4318094

View File

@ -367,7 +367,7 @@ debug_get_stk_seg() {
return task->stk; return task->stk;
} }
extern "C" CDECL rust_vec* extern "C" CDECL rust_vec_box*
rust_list_files(rust_str *path) { rust_list_files(rust_str *path) {
rust_task *task = rust_get_current_task(); rust_task *task = rust_get_current_task();
array_list<rust_str*> strings; array_list<rust_str*> strings;
@ -397,12 +397,12 @@ rust_list_files(rust_str *path) {
} }
#endif #endif
rust_vec *vec = (rust_vec *) rust_vec_box *vec = (rust_vec_box *)
task->kernel->malloc(vec_size<rust_vec*>(strings.size()), task->kernel->malloc(vec_size<rust_vec_box*>(strings.size()),
"list_files_vec"); "list_files_vec");
size_t alloc_sz = sizeof(rust_vec*) * strings.size(); size_t alloc_sz = sizeof(rust_vec*) * strings.size();
vec->fill = vec->alloc = alloc_sz; vec->body.fill = vec->body.alloc = alloc_sz;
memcpy(&vec->data[0], strings.data(), alloc_sz); memcpy(&vec->body.data[0], strings.data(), alloc_sz);
return vec; return vec;
} }