summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/cache.c')
-rw-r--r--lib/libalpm/cache.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 8c8e7669..709ba383 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -145,21 +145,11 @@ int db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
pmpkg_t *db_get_pkgfromcache(pmdb_t *db, char *target)
{
- PMList *i;
-
- if(db == NULL || target == NULL || strlen(target) == 0) {
+ if(db == NULL) {
return(NULL);
}
- for(i = db_get_pkgcache(db); i; i = i->next) {
- pmpkg_t *info = i->data;
-
- if(strcmp(info->name, target) == 0) {
- return(info);
- }
- }
-
- return(NULL);
+ return(pkg_isin(target, db_get_pkgcache(db)));
}
/* Returns a new group cache from db.