about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorKevin Cantu <me@kevincantu.org>2012-01-25 02:25:57 -0800
committerKevin Cantu <me@kevincantu.org>2012-01-25 02:25:57 -0800
commitfec36de94e02e9c7c6fec05a2aea32bfbdc2f0f8 (patch)
tree6e6a16fed052b55b12aa8b986ab68c478ba4850c /src/libcore
parenta185b106471b4bc894393aecb31a23b71c8a4886 (diff)
Making str::from_cstr UTF-8 safe
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/str.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 36453d78c98..b8d9a1dea11 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -217,16 +217,16 @@ Function: from_cstr
 Create a Rust string from a null-terminated C string
 */
 unsafe fn from_cstr(cstr: sbuf) -> str {
-    let res = "";
+    let res = [];
     let start = cstr;
     let curr = start;
     let i = 0u;
     while *curr != 0u8 {
-        push_byte(res, *curr);
+        vec::push(res, *curr);
         i += 1u;
         curr = ptr::offset(start, i);
     }
-    ret res;
+    ret from_bytes(res);
 }
 
 /*