diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustrt/c_str.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/librustrt/c_str.rs b/src/librustrt/c_str.rs index a4129fe3506..0ef0601828d 100644 --- a/src/librustrt/c_str.rs +++ b/src/librustrt/c_str.rs @@ -275,15 +275,7 @@ impl Collection for CString { /// Return the number of bytes in the CString (not including the NUL terminator). #[inline] fn len(&self) -> uint { - let mut cur = self.buf; - let mut len = 0; - unsafe { - while *cur != 0 { - len += 1; - cur = cur.offset(1); - } - } - return len; + unsafe { libc::strlen(self.buf) as uint } } } |
