@@ -186,7 +186,7 @@ fn from_chars(chs: [char]) -> str {
186
186
}
187
187
188
188
#[ doc = "Create a Rust string from a null-terminated *u8 buffer" ]
189
- fn from_buf ( buf : * u8 ) -> str unsafe {
189
+ unsafe fn from_buf ( buf : * u8 ) -> str {
190
190
let mut curr = buf, i = 0 u;
191
191
while * curr != 0u8 {
192
192
i += 1 u;
@@ -196,12 +196,12 @@ fn from_buf(buf: *u8) -> str unsafe {
196
196
}
197
197
198
198
#[ doc = "Create a Rust string from a null-terminated C string" ]
199
- fn from_c_str ( c_str : * libc:: c_char ) -> str unsafe {
199
+ unsafe fn from_c_str ( c_str : * libc:: c_char ) -> str {
200
200
from_buf ( :: unsafe:: reinterpret_cast ( c_str) )
201
201
}
202
202
203
203
#[ doc = "Create a Rust string from a *u8 buffer of the given length" ]
204
- fn from_buf_len ( buf : * u8 , len : uint ) -> str unsafe {
204
+ unsafe fn from_buf_len ( buf : * u8 , len : uint ) -> str {
205
205
let mut v: [ u8 ] = [ ] ;
206
206
vec:: reserve ( v, len + 1 u) ;
207
207
vec:: as_buf ( v) { |b| ptr:: memcpy ( b, buf, len) ; }
@@ -215,7 +215,7 @@ fn from_buf_len(buf: *u8, len: uint) -> str unsafe {
215
215
}
216
216
217
217
#[ doc = "Create a Rust string from a `*c_char` buffer of the given length" ]
218
- fn from_c_str_len ( c_str : * libc:: c_char , len : uint ) -> str unsafe {
218
+ unsafe fn from_c_str_len ( c_str : * libc:: c_char , len : uint ) -> str {
219
219
from_buf_len ( :: unsafe:: reinterpret_cast ( c_str) , len)
220
220
}
221
221
0 commit comments