diff --git a/Cargo.toml b/Cargo.toml index 49f5797354d08..df298044fd834 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ license = "Unlicense/MIT" name = "memchr" [dependencies] -libc = "0.2" +libc = "0.2.4" [dev-dependencies] quickcheck = "0.2" diff --git a/src/lib.rs b/src/lib.rs index 2475bcb6a2af5..342e55eaf7a27 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,7 +84,7 @@ pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { // GNU's memrchr() will - unlike memchr() - error if haystack is empty. if haystack.is_empty() {return None} let p = unsafe { - ffi::memrchr( + libc::memrchr( haystack.as_ptr() as *const c_void, needle as c_int, haystack.len() as size_t) @@ -253,15 +253,6 @@ mod fallback { } } -#[cfg(target_os = "linux")] -mod ffi { - use libc::c_void; - use libc::{c_int, size_t}; - extern { - pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; - } -} - #[cfg(test)] mod tests { extern crate quickcheck;