[pacman-dev] [PATCH] Unify the order of alpm_list_fn_cmp parameters

Nagy Gabor ngaba at bibl.u-szeged.hu
Thu May 1 18:26:42 EDT 2008


From 82de17753e8be6c125781e331cd8b526876008fb Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Fri, 2 May 2008 00:25:08 +0200
Subject: [PATCH] Unify the order of alpm_list_fn_cmp parameters

In some cases we pass tricky asymmetric alpm_list_fn_cmp functions to alpm_list_find
and alpm_list_remove, and the order of parameters wasn't coherent.

Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
 lib/libalpm/alpm_list.c |    2 +-
 lib/libalpm/db.c        |    2 +-
 lib/libalpm/deps.c      |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
index ae54e19..ecfef25 100644
--- a/lib/libalpm/alpm_list.c
+++ b/lib/libalpm/alpm_list.c
@@ -577,7 +577,7 @@ void SYMEXPORT *alpm_list_find(const alpm_list_t *haystack, const void *needle,
 {
 	const alpm_list_t *lp = haystack;
 	while(lp) {
-		if(lp->data && fn(lp->data, needle) == 0) {
+		if(lp->data && fn(needle, lp->data) == 0) {
 			return(lp->data);
 		}
 		lp = lp->next;
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index e8ae11a..bc11ad7 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -627,7 +627,7 @@ pmdb_t *_alpm_db_register_sync(const char *treename)
  *
  * @return "provision.name" == needle (as string)
  */
-int _alpm_prov_cmp(const void *provision, const void *needle)
+int _alpm_prov_cmp(const void *needle, const void *provision)
 {
 	char *tmpptr;
 	char *provname = strdup(provision);
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 9cae0e2..bbc8cd5 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -195,7 +195,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
 }
 
 /* Little helper function for alpm_list_find */
-static int satisfycmp(const void *pkg, const void *depend)
+static int satisfycmp(const void *depend, const void *pkg)
 {
 	return(!alpm_depcmp((pmpkg_t*) pkg, (pmdepend_t*) depend));
 }
-- 
1.5.3.8





More information about the pacman-dev mailing list