[pacman-dev] [PATCH] Swap the parameters of alpm_pkg_find (resubmit)
Nagy Gabor
ngaba at bibl.u-szeged.hu
Thu May 1 18:00:40 EDT 2008
From 6a15dd711a033609ad6ac007f8c55ac1ce045206 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Thu, 1 May 2008 23:58:33 +0200
Subject: [PATCH] Swap the parameters of alpm_pkg_find
Now the syntax is coherent with alpm_list_find and alpm_sync_find.
Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
lib/libalpm/cache.c | 2 +-
lib/libalpm/deps.c | 12 ++++++------
lib/libalpm/package.c | 2 +-
lib/libalpm/package.h | 2 +-
lib/libalpm/remove.c | 4 ++--
lib/libalpm/sync.c | 6 +++---
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index bfc4fd9..77cd292 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -171,7 +171,7 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
return(NULL);
}
- return(_alpm_pkg_find(target, pkgcache));
+ return(_alpm_pkg_find(pkgcache, target));
}
/* Returns a new group cache from db.
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index b171ccc..9cae0e2 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -440,7 +440,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
{
alpm_list_t *i, *j;
- if(_alpm_pkg_find(alpm_pkg_get_name(pkg), targets)) {
+ if(_alpm_pkg_find(targets, alpm_pkg_get_name(pkg))) {
return(0);
}
@@ -464,7 +464,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
pmpkg_t *lpkg = i->data;
for(j = alpm_pkg_get_depends(lpkg); j; j = j->next) {
if(alpm_depcmp(pkg, j->data)) {
- if(!_alpm_pkg_find(lpkg->name, targets)) {
+ if(!_alpm_pkg_find(targets, lpkg->name)) {
return(0);
}
break;
@@ -571,8 +571,8 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
if(!sync) {
continue;
}
- found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove)
- && !_alpm_pkg_find(alpm_pkg_get_name(sync), *list);
+ found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(remove, alpm_pkg_get_name(sync))
+ && !_alpm_pkg_find(*list, alpm_pkg_get_name(sync));
if(!found) {
continue;
}
@@ -594,8 +594,8 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
continue;
}
found = alpm_depcmp(sync, missdep) && strcmp(sync->name, missdep->name)
- && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove)
- && !_alpm_pkg_find(alpm_pkg_get_name(sync), *list);
+ && !_alpm_pkg_find(remove, alpm_pkg_get_name(sync))
+ && !_alpm_pkg_find(*list, alpm_pkg_get_name(sync));
if(!found) {
continue;
}
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index ffaa96b..ab49492 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -1093,7 +1093,7 @@ error:
/* Test for existence of a package in a alpm_list_t*
* of pmpkg_t*
*/
-pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack)
+pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
{
alpm_list_t *lp;
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 0ba8aac..99cd47d 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -82,7 +82,7 @@ int _alpm_pkg_cmp(const void *p1, const void *p2);
int _alpm_pkgname_pkg_cmp(const void *pkgname, const void *package);
int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full);
-pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
+pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle);
int _alpm_pkg_should_ignore(pmpkg_t *pkg);
#endif /* _ALPM_PACKAGE_H */
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index f2e84ef..c70e2b9 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -56,7 +56,7 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- if(_alpm_pkg_find(name, trans->packages)) {
+ if(_alpm_pkg_find(trans->packages, name)) {
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
}
@@ -92,7 +92,7 @@ static void remove_prepare_cascade(pmtrans_t *trans, pmdb_t *db,
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
pmpkg_t *info = _alpm_db_get_pkgfromcache(db, miss->target);
if(info) {
- if(!_alpm_pkg_find(alpm_pkg_get_name(info), trans->packages)) {
+ if(!_alpm_pkg_find(trans->packages, alpm_pkg_get_name(info))) {
_alpm_log(PM_LOG_DEBUG, "pulling %s in the targets list\n",
alpm_pkg_get_name(info));
trans->packages = alpm_list_add(trans->packages, _alpm_pkg_dup(info));
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 357b01f..3743f9b 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -227,7 +227,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans,
for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) {
pmpkg_t *local = i->data;
- if(_alpm_pkg_find(alpm_pkg_get_name(local), replaced)) {
+ if(_alpm_pkg_find(replaced, alpm_pkg_get_name(local))) {
_alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping\n",
alpm_pkg_get_name(local));
continue;
@@ -583,7 +583,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
int found = 0;
for(j = trans->packages; j && !found; j = j->next) {
pmsyncpkg_t *sync = j->data;
- if(_alpm_pkg_find(conflict->package2, sync->removes)) {
+ if(_alpm_pkg_find(sync->removes, conflict->package2)) {
found = 1;
}
}
@@ -954,7 +954,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
alpm_list_t *j;
for(j = sync->removes; j; j = j->next) {
pmpkg_t *pkg = j->data;
- if(!_alpm_pkg_find(pkg->name, tr->packages)) {
+ if(!_alpm_pkg_find(tr->packages, pkg->name)) {
if(_alpm_trans_addtarget(tr, pkg->name) == -1) {
goto error;
}
--
1.5.3.8
More information about the pacman-dev
mailing list