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@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Nagy Gabor 2008-05-01 23:58:33 +02:00 committed by Dan McGee
parent e80232f24c
commit 8248b4bfb1
6 changed files with 14 additions and 14 deletions

View File

@ -170,7 +170,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.

View File

@ -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;
}

View File

@ -851,7 +851,7 @@ int _alpm_pkgname_pkg_cmp(const void *pkgname, const void *package)
/* 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;

View File

@ -81,7 +81,7 @@ void _alpm_pkg_free(pmpkg_t *pkg);
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_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 */

View File

@ -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));

View File

@ -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;
}