]> git.lizzy.rs Git - rust.git/commitdiff
`usize` is now a proper ctype, so fix cmp_slice
authorubsan <npmazzuca@gmail.com>
Fri, 4 Mar 2016 03:53:31 +0000 (19:53 -0800)
committerubsan <npmazzuca@gmail.com>
Fri, 4 Mar 2016 03:53:31 +0000 (19:53 -0800)
src/libcore/str/mod.rs

index 4d367cfd432f94a2f5333ec3bbbcdc94b33b493c..14f189409be63ed8a6ec1fec66a30fe0e23d4caf 100644 (file)
@@ -1095,8 +1095,6 @@ fn eq_slice(a: &str, b: &str) -> bool {
 /// faster than comparing each byte in a loop.
 #[inline]
 unsafe fn cmp_slice(a: &str, b: &str, len: usize) -> i32 {
-    // NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
-    #[allow(improper_ctypes)]
     extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
     memcmp(a.as_ptr() as *const i8, b.as_ptr() as *const i8, len)
 }