From 9a359a5e634c85c3671efe863aa5b3948b7e7898 Mon Sep 17 00:00:00 2001 From: kozorizki Date: Thu, 24 Oct 2024 11:46:21 +0300 Subject: [PATCH] fix(raw.rs): pkg_cache_find_name_arch function signature Removed from the function signature the parameter (arch: *const c_char) for alt-linux cfg --- src/raw.rs | 7 +++++++ src/sane.rs | 6 ++++++ 2 files changed, 13 insertions(+) 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) } }