about summary refs log tree commit diff
path: root/src/rt/rust.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-09-01 13:40:11 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-01 15:51:47 -0700
commit372aa4d2107ddaa5de98a0f71e66ffd9d0f59562 (patch)
tree7118a2daf7379143d592a56b6b80360dae9f44f8 /src/rt/rust.cpp
parent3690f38d798b2a0009af9c18ba034f7a2411390e (diff)
downloadrust-372aa4d2107ddaa5de98a0f71e66ffd9d0f59562.tar.gz
rust-372aa4d2107ddaa5de98a0f71e66ffd9d0f59562.zip
Factor out make_istr utility function in runtime. Issue #855
Diffstat (limited to 'src/rt/rust.cpp')
-rw-r--r--src/rt/rust.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index a7411b98cd0..c3b6526a4a3 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -66,14 +66,9 @@ command_line_args : public kernel_owned<command_line_args>
                            "command line arg interior");
         args_istr->fill = args_istr->alloc = sizeof(rust_vec*) * argc;
         for (int i = 0; i < argc; ++i) {
-            size_t str_fill = strlen(argv[i]) + 1;
-            size_t str_alloc = str_fill;
-            rust_vec *str = (rust_vec *)
-                kernel->malloc(vec_size<char>(str_fill),
-                               "command line arg");
-            str->fill = str_fill;
-            str->alloc = str_alloc;
-            memcpy(&str->data, argv[i], str_fill);
+            rust_vec *str = make_istr(kernel, argv[i],
+                                      strlen(argv[i]),
+                                      "command line arg");
             ((rust_vec**)&args_istr->data)[i] = str;
         }
     }