about summary refs log tree commit diff
path: root/src/rt
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-09-02 17:00:40 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-02 22:11:46 -0700
commit1b67d211b40b268180c3642fc8f6f09cbf0895a6 (patch)
tree10159d086cab03097aa59118d87cbcd08b2203b9 /src/rt
parent01b254b411a954ebed24a38f873e02b7f6edd0a6 (diff)
downloadrust-1b67d211b40b268180c3642fc8f6f09cbf0895a6.tar.gz
rust-1b67d211b40b268180c3642fc8f6f09cbf0895a6.zip
Add a rust_str typedef to the runtime. Issue #855
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust.cpp4
-rw-r--r--src/rt/rust_builtin.cpp16
-rw-r--r--src/rt/rust_util.h6
3 files changed, 14 insertions, 12 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 25fb9331314..fbf6ff7a08b 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -43,10 +43,10 @@ command_line_args : public kernel_owned<command_line_args>
                            "command line arg interior");
         args->fill = args->alloc = sizeof(rust_vec*) * argc;
         for (int i = 0; i < argc; ++i) {
-            rust_vec *str = make_str(kernel, argv[i],
+            rust_str *str = make_str(kernel, argv[i],
                                      strlen(argv[i]),
                                      "command line arg");
-            ((rust_vec**)&args->data)[i] = str;
+            ((rust_str**)&args->data)[i] = str;
         }
     }
 
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index a09e7ac1849..f8fc85a0fe1 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -7,7 +7,7 @@
 
 /* Native builtins. */
 
-extern "C" CDECL rust_vec*
+extern "C" CDECL rust_str*
 last_os_error(rust_task *task) {
     LOG(task, task, "last_os_error()");
 
@@ -40,15 +40,15 @@ last_os_error(rust_task *task) {
     }
 #endif
 
-    rust_vec * st = make_str(task->kernel, buf, strlen(buf),
-                              "last_os_error");
+    rust_str * st = make_str(task->kernel, buf, strlen(buf),
+                             "last_os_error");
 #ifdef __WIN32__
     LocalFree((HLOCAL)buf);
 #endif
     return st;
 }
 
-extern "C" CDECL rust_vec *
+extern "C" CDECL rust_str *
 rust_getcwd(rust_task *task) {
     LOG(task, task, "rust_getcwd()");
 
@@ -323,15 +323,15 @@ debug_ptrcast(rust_task *task,
 
 extern "C" CDECL rust_vec*
 rust_list_files(rust_task *task, rust_vec **path) {
-    array_list<rust_vec*> strings;
+    array_list<rust_str*> strings;
 #if defined(__WIN32__)
     WIN32_FIND_DATA FindFileData;
     HANDLE hFind = FindFirstFile((char*)(*path)->data, &FindFileData);
     if (hFind != INVALID_HANDLE_VALUE) {
         do {
-            rust_vec *str = make_str(task->kernel, FindFileData.cFileName,
-                                      strlen(FindFileData.cFileName),
-                                      "list_files_str");
+            rust_str *str = make_str(task->kernel, FindFileData.cFileName,
+                                     strlen(FindFileData.cFileName),
+                                     "list_files_str");
             strings.push(str);
         } while (FindNextFile(hFind, &FindFileData));
         FindClose(hFind);
diff --git a/src/rt/rust_util.h b/src/rt/rust_util.h
index 25886aef74b..50545b21310 100644
--- a/src/rt/rust_util.h
+++ b/src/rt/rust_util.h
@@ -188,11 +188,13 @@ inline void reserve_vec(rust_task* task, rust_vec** vpp, size_t size) {
     }
 }
 
-inline rust_vec *
+typedef rust_vec rust_str;
+
+inline rust_str *
 make_str(rust_kernel* kernel, char* c, size_t strlen, const char* name) {
     size_t str_fill = strlen + 1;
     size_t str_alloc = str_fill;
-    rust_vec *str = (rust_vec *)
+    rust_str *str = (rust_str *)
         kernel->malloc(vec_size<char>(str_fill), name);
     str->fill = str_fill;
     str->alloc = str_alloc;