summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-18 22:37:16 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-01-18 22:37:16 +0000
commitcf94007aed7eb87a38090a62b9ddf606ea1343c9 (patch)
tree828390f91f1e8510522c63d97d9c61cf443bbc24 /lib/libalpm/package.c
parentc7bcaeb7e82b9b74ab9734863827ff98db2b1fdd (diff)
downloadpacman-cf94007aed7eb87a38090a62b9ddf606ea1343c9.tar.xz
more code cleanup yet
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index eda87f18..bf5585d2 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -373,30 +373,23 @@ error:
/* Test for existence of a package in a PMList*
* of pmpkg_t*
- *
- * returns: 0 for no match
- * 1 for identical match
- * -1 for name-only match (version mismatch)
*/
-int pkg_isin(pmpkg_t *needle, PMList *haystack)
+pmpkg_t *pkg_isin(char *needle, PMList *haystack)
{
PMList *lp;
if(needle == NULL || haystack == NULL) {
- return(0);
+ return(NULL);
}
for(lp = haystack; lp; lp = lp->next) {
pmpkg_t *info = lp->data;
- if(info && !strcmp(info->name, needle->name)) {
- if(!strcmp(info->version, needle->version)) {
- return(1);
- }
- return(-1);
+ if(info && !strcmp(info->name, needle)) {
+ return(lp->data);
}
}
- return(0);
+ return(NULL);
}
int pkg_splitname(char *target, char *name, char *version)