diff --git a/src/raw.rs b/src/raw.rs index a599a44..e743773 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -35,10 +35,17 @@ extern "C" { pub fn pkg_cache_pkg_iter(cache: PCache) -> PPkgIterator; pub fn pkg_cache_find_name(cache: PCache, name: *const c_char) -> PPkgIterator; + #[cfg(feature = "alt-linux")] pub fn pkg_cache_find_name_arch( cache: PCache, name: *const c_char, ) -> PPkgIterator; + #[cfg(not(feature = "alt-linux"))] + pub fn pkg_cache_find_name_arch( + cache: PCache, + name: *const c_char, + ) -> PPkgIterator; + pub fn pkg_iter_release(iterator: PPkgIterator); pub fn pkg_iter_next(iterator: PPkgIterator); diff --git a/src/sane.rs b/src/sane.rs index f0eecf5..cfffc2e 100644 --- a/src/sane.rs +++ b/src/sane.rs @@ -66,7 +66,13 @@ impl Cache { unsafe { let name = ffi::CString::new(name).unwrap(); let arch = ffi::CString::new(arch).unwrap(); + + #[cfg(feature = "alt-linux")] + let ptr = raw::pkg_cache_find_name_arch(lock.ptr, name.as_ptr()); + + #[cfg(not(feature = "alt-linux"))] let ptr = raw::pkg_cache_find_name_arch(lock.ptr, name.as_ptr(), arch.as_ptr()); + PkgIterator::new(lock, ptr) } }