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 2fffbe0 commit 4765bb9Copy full SHA for 4765bb9
src/librustrt/c_str.rs
@@ -275,15 +275,7 @@ impl Collection for CString {
275
/// Return the number of bytes in the CString (not including the NUL terminator).
276
#[inline]
277
fn len(&self) -> uint {
278
- let mut cur = self.buf;
279
- let mut len = 0;
280
- unsafe {
281
- while *cur != 0 {
282
- len += 1;
283
- cur = cur.offset(1);
284
- }
285
286
- return len;
+ unsafe { libc::strlen(self.buf) as uint }
287
}
288
289
0 commit comments