[pacman-dev] [PATCH] Swap the parameters of alpm_pkg_find
From eda8bb35123e21b268bdd38b443d4de07e0dd20c Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Mon, 21 Apr 2008 12:43:55 +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@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 7fa2405..95d7657 100644 --- a/lib/libalpm/cache.c +++ b/lib/libalpm/cache.c @@ -172,7 +172,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 4216e2c..cec69be 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -441,7 +441,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); } @@ -465,7 +465,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; @@ -572,8 +572,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; } @@ -595,8 +595,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 587e7fc..1ce0194 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -1106,7 +1106,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 f3de05d..05b92c7 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -80,7 +80,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 556d175..3e38c5d 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -57,7 +57,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); } @@ -114,7 +114,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) pmdepmissing_t *miss = (pmdepmissing_t *)i->data; pmpkg_t *info = _alpm_db_scan(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, info); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 5b3087a..7bcd982 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -228,7 +228,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; @@ -537,7 +537,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; } } @@ -996,7 +996,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
Nagy Gabor wrote:
From eda8bb35123e21b268bdd38b443d4de07e0dd20c Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Mon, 21 Apr 2008 12:43:55 +0200 Subject: [PATCH] Swap the parameters of alpm_pkg_find
Now the syntax is coherent with alpm_list_find and alpm_sync_find.
I like this, but unfortunately, I am not able to apply it, not even partly, and I don't have the motivation to redo it all again :) Can you try applying this again current master branch? Thanks!
Idézés Xavier <shiningxc@gmail.com>:
Nagy Gabor wrote:
From eda8bb35123e21b268bdd38b443d4de07e0dd20c Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Mon, 21 Apr 2008 12:43:55 +0200 Subject: [PATCH] Swap the parameters of alpm_pkg_find
Now the syntax is coherent with alpm_list_find and alpm_sync_find.
I like this, but unfortunately, I am not able to apply it, not even partly, and I don't have the motivation to redo it all again :) Can you try applying this again current master branch? Thanks!
atm I cannot resubmit it (or get the current master), probably you cannot apply because it depends on my previous kill computerequiredby patch (iirc) Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/
2008/4/25 Nagy Gabor <ngaba@bibl.u-szeged.hu>:
atm I cannot resubmit it (or get the current master), probably you cannot apply because it depends on my previous kill computerequiredby patch (iirc)
I tried both on current master and current master + compute requiredby patch. As Dan was saying yesterday, it would probably be much easier for us if you could host your git tree somewhere. That way, we could see where it applies, and it would be easier for us to rebase it. Also, I personally had troubles many times with your patches that had weird formatting issues in the mail. Though it doesn't seem to be the case this time.
participants (2)
-
Nagy Gabor
-
Xavier