We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a185b10 commit fec36deCopy full SHA for fec36de
src/libcore/str.rs
@@ -217,16 +217,16 @@ Function: from_cstr
217
Create a Rust string from a null-terminated C string
218
*/
219
unsafe fn from_cstr(cstr: sbuf) -> str {
220
- let res = "";
+ let res = [];
221
let start = cstr;
222
let curr = start;
223
let i = 0u;
224
while *curr != 0u8 {
225
- push_byte(res, *curr);
+ vec::push(res, *curr);
226
i += 1u;
227
curr = ptr::offset(start, i);
228
}
229
- ret res;
+ ret from_bytes(res);
230
231
232
/*
0 commit comments