Skip to content

Commit 4d788be

Browse files
committed
from_cstr and from_cstr_len are not unsafe, I think
1 parent 8d29e87 commit 4d788be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Function: from_cstr
194194
195195
Create a Rust string from a null-terminated C string
196196
*/
197-
unsafe fn from_cstr(cstr: sbuf) -> str {
197+
fn from_cstr(cstr: sbuf) -> str unsafe {
198198
let start = cstr;
199199
let curr = start;
200200
let i = 0u;
@@ -210,7 +210,7 @@ Function: from_cstr_len
210210
211211
Create a Rust string from a C string of the given length
212212
*/
213-
unsafe fn from_cstr_len(cstr: sbuf, len: uint) -> str {
213+
fn from_cstr_len(cstr: sbuf, len: uint) -> str unsafe {
214214
let buf: [u8] = [];
215215
vec::reserve(buf, len + 1u);
216216
vec::as_buf(buf) {|b| ptr::memcpy(b, cstr, len); }

0 commit comments

Comments
 (0)