about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-20 23:21:27 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-21 09:27:38 -0800
commita666105b4c273d128a0a15c3342412c69c89fb98 (patch)
tree72709d7280f6af2b3895d4aab47c39248f0653ec /src/libstd
parentc141f223d4fd4d8c8be8649877e08ddceaa43783 (diff)
downloadrust-a666105b4c273d128a0a15c3342412c69c89fb98.tar.gz
rust-a666105b4c273d128a0a15c3342412c69c89fb98.zip
std: Don't parse argv as a String
Instead, just pass everything through as a Vec<u8> to get worried about later.

Closes #20091
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/rt/args.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs
index 3a4705f58b4..b1f268597c7 100644
--- a/src/libstd/rt/args.rs
+++ b/src/libstd/rt/args.rs
@@ -44,12 +44,10 @@ pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() }
           target_os = "freebsd",
           target_os = "dragonfly"))]
 mod imp {
-    use core::prelude::*;
+    use prelude::*;
 
-    use boxed::Box;
-    use vec::Vec;
-    use string::String;
     use mem;
+    use slice;
 
     use sync::{StaticMutex, MUTEX_INIT};
 
@@ -98,7 +96,12 @@ mod imp {
 
     unsafe fn load_argc_and_argv(argc: int, argv: *const *const u8) -> Vec<Vec<u8>> {
         Vec::from_fn(argc as uint, |i| {
-            String::from_raw_buf(*argv.offset(i as int)).into_bytes()
+            let arg = *argv.offset(i as int);
+            let mut len = 0u;
+            while *arg.offset(len as int) != 0 {
+                len += 1u;
+            }
+            slice::from_raw_buf(&arg, len).to_vec()
         })
     }