From 8fbdd03cce3c04a8208df30f435bc3e91a84ade3 Mon Sep 17 00:00:00 2001
From: Aaron Griffin <aaron@archlinux.org>
Date: Mon, 26 Feb 2007 08:38:48 +0000
Subject: [PATCH] * Enforce const char* params when using strings * Unified
 some functions names "package" -> "pkg" for consistency * Removed the goofy
 'faketarget' stuff used for dep testing * Renamed alpm_pkg_isin ->
 alpm_pkg_find * Renamed alpm_db_readpkg -> alpm_db_get_pkg

---
 lib/libalpm/add.c      | 54 ------------------------------------------
 lib/libalpm/alpm.c     |  8 +++----
 lib/libalpm/alpm.h     | 14 +++++------
 lib/libalpm/be_files.c |  2 +-
 lib/libalpm/cache.c    |  6 ++---
 lib/libalpm/cache.h    |  4 ++--
 lib/libalpm/db.c       |  4 ++--
 lib/libalpm/db.h       |  6 ++---
 lib/libalpm/deps.c     | 16 ++++++-------
 lib/libalpm/group.c    |  2 +-
 lib/libalpm/package.c  | 21 ++++++++--------
 lib/libalpm/package.h  |  6 ++---
 lib/libalpm/provide.c  |  2 +-
 lib/libalpm/provide.h  |  2 +-
 lib/libalpm/remove.c   |  2 +-
 lib/libalpm/sync.c     |  8 +++----
 lib/libalpm/trans.c    |  4 ++--
 17 files changed, 54 insertions(+), 107 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 3fe77b19..2e40c98e 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -58,55 +58,6 @@
 #include "remove.h"
 #include "handle.h"
 
-static int add_faketarget(pmtrans_t *trans, char *name)
-{
-	char *ptr, *p;
-	char *str = NULL;
-	pmpkg_t *dummy = NULL;
-
-	ALPM_LOG_FUNC;
-
-	dummy = _alpm_pkg_new(NULL, NULL);
-	if(dummy == NULL) {
-		RET_ERR(PM_ERR_MEMORY, -1);
-	}
-
-	/* Format: field1=value1|field2=value2|...
-	 * Valid fields are "name", "version" and "depend"
-	 */
-	str = strdup(name);
-	ptr = str;
-	while((p = strsep(&ptr, "|")) != NULL) {
-		char *q;
-		if(p[0] == 0) {
-			continue;
-		}
-		q = strchr(p, '=');
-		if(q == NULL) { /* not a valid token */
-			continue;
-		}
-		if(strncmp("name", p, q-p) == 0) {
-			STRNCPY(dummy->name, q+1, PKG_NAME_LEN);
-		} else if(strncmp("version", p, q-p) == 0) {
-			STRNCPY(dummy->version, q+1, PKG_VERSION_LEN);
-		} else if(strncmp("depend", p, q-p) == 0) {
-			dummy->depends = alpm_list_add(dummy->depends, strdup(q+1));
-		} else {
-			_alpm_log(PM_LOG_ERROR, _("could not parse token %s"), p);
-		}
-	}
-	FREE(str);
-	if(dummy->name[0] == 0 || dummy->version[0] == 0) {
-		FREEPKG(dummy);
-		RET_ERR(PM_ERR_PKG_INVALID_NAME, -1);
-	}
-
-	/* add the package to the transaction */
-	trans->packages = alpm_list_add(trans->packages, dummy);
-
-	return(0);
-}
-
 int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
 {
 	pmpkg_t *info = NULL;
@@ -121,11 +72,6 @@ int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
 	ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
 	ASSERT(name != NULL && strlen(name) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
 
-	/* Check if we need to add a fake target to the transaction. */
-	if(strchr(name, '|')) {
-		return(add_faketarget(trans, name));
-	}
-
 	_alpm_log(PM_LOG_DEBUG, _("loading target '%s'"), name);
 
 	/* TODO FS#5120 we need a better way to check if a package is a valid package,
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index ba96606f..fe7a369f 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -330,7 +330,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
  * @param name of the package
  * @return the package entry on success, NULL on error
  */
-pmpkg_t SYMEXPORT *alpm_db_readpkg(pmdb_t *db, char *name)
+pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
 {
 	ALPM_LOG_FUNC;
 
@@ -362,7 +362,7 @@ alpm_list_t SYMEXPORT *alpm_db_getpkgcache(pmdb_t *db)
  * @param name name of the package
  * @return the list of packages on success, NULL on error
  */
-alpm_list_t SYMEXPORT *alpm_db_whatprovides(pmdb_t *db, char *name)
+alpm_list_t SYMEXPORT *alpm_db_whatprovides(pmdb_t *db, const char *name)
 {
 	ALPM_LOG_FUNC;
 
@@ -379,7 +379,7 @@ alpm_list_t SYMEXPORT *alpm_db_whatprovides(pmdb_t *db, char *name)
  * @param name of the group
  * @return the groups entry on success, NULL on error
  */
-pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, char *name)
+pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
 {
 	ALPM_LOG_FUNC;
 
@@ -1153,7 +1153,7 @@ alpm_list_t *alpm_get_upgrades()
 		for(j = syncpkgs; j && !replace; j=j->next) {
 			sync = j->data;
 			if(sync->type == PM_SYNC_TYPE_REPLACE) {
-				if(_alpm_pkg_isin(spkg->name, sync->data)) {
+				if(_alpm_pkg_find(spkg->name, sync->data)) {
 					replace=1;
 				}
 			}
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 5a71cd86..9a093a97 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -161,7 +161,7 @@ alpm_list_t *alpm_option_get_syncdbs();
  */
 
 /* Database registration callback */
-typedef void (*alpm_cb_db_register)(char *, pmdb_t *);
+typedef void (*alpm_cb_db_register)(const char *, pmdb_t *);
 
 pmdb_t *alpm_db_register(char *treename);
 int alpm_db_unregister(pmdb_t *db);
@@ -173,11 +173,11 @@ int alpm_db_setserver(pmdb_t *db, const char *url);
 
 int alpm_db_update(int level, pmdb_t *db);
 
-pmpkg_t *alpm_db_readpkg(pmdb_t *db, char *name);
+pmpkg_t *alpm_db_get_pkg(pmdb_t *db, const char *name);
 alpm_list_t *alpm_db_getpkgcache(pmdb_t *db);
-alpm_list_t *alpm_db_whatprovides(pmdb_t *db, char *name);
+alpm_list_t *alpm_db_whatprovides(pmdb_t *db, const char *name);
 
-pmgrp_t *alpm_db_readgrp(pmdb_t *db, char *name);
+pmgrp_t *alpm_db_readgrp(pmdb_t *db, const char *name);
 alpm_list_t *alpm_db_getgrpcache(pmdb_t *db);
 alpm_list_t *alpm_db_search(pmdb_t *db, alpm_list_t* needles);
 
@@ -242,7 +242,7 @@ unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg);
  * Groups
  */
 const char *alpm_grp_get_name(pmgrp_t *grp);
-alpm_list_t *alpm_grp_get_packages(pmgrp_t *grp);
+alpm_list_t *alpm_grp_get_pkgs(pmgrp_t *grp);
 
 /*
  * Sync
@@ -256,7 +256,7 @@ typedef enum _pmsynctype_t {
 } pmsynctype_t;
 
 pmsynctype_t alpm_sync_get_type(pmsyncpkg_t *sync);
-pmpkg_t *alpm_sync_get_package(pmsyncpkg_t *sync);
+pmpkg_t *alpm_sync_get_pkg(pmsyncpkg_t *sync);
 void *alpm_sync_get_data(pmsyncpkg_t *sync);
 
 /*
@@ -348,7 +348,7 @@ typedef void (*alpm_trans_cb_progress)(pmtransprog_t, char *, int, int, int);
 pmtranstype_t alpm_trans_get_type();
 unsigned int alpm_trans_get_flags();
 alpm_list_t * alpm_trans_get_targets();
-alpm_list_t * alpm_trans_get_packages();
+alpm_list_t * alpm_trans_get_pkgs();
 int alpm_trans_init(pmtranstype_t type, unsigned int flags,
                     alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
                     alpm_trans_cb_progress cb_progress);
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 8830ea5c..41349048 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -106,7 +106,7 @@ void _alpm_db_rewind(pmdb_t *db)
 	rewinddir(db->handle);
 }
 
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
+pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target, pmdbinfrq_t inforeq)
 {
 	struct dirent *ent = NULL;
 	struct stat sbuf;
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 57992d87..8e043096 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -187,7 +187,7 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
 	return(0);
 }
 
-pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target)
+pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
 {
 	ALPM_LOG_FUNC;
 
@@ -201,7 +201,7 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target)
 		return(NULL);
 	}
 
-	return(_alpm_pkg_isin(target, pkgcache));
+	return(_alpm_pkg_find(target, pkgcache));
 }
 
 /* Returns a new group cache from db.
@@ -286,7 +286,7 @@ alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
 	return(db->grpcache);
 }
 
-pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, char *target)
+pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target)
 {
 	alpm_list_t *i;
 
diff --git a/lib/libalpm/cache.h b/lib/libalpm/cache.h
index 0ec2863e..7efae5b8 100644
--- a/lib/libalpm/cache.h
+++ b/lib/libalpm/cache.h
@@ -33,12 +33,12 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
 int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
 alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
 int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
-pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target);
+pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
 /* groups */
 int _alpm_db_load_grpcache(pmdb_t *db);
 void _alpm_db_free_grpcache(pmdb_t *db);
 alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db);
-pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, char *target);
+pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target);
 
 #endif /* _ALPM_CACHE_H */
 
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index f61487a5..8a7210d3 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -51,7 +51,7 @@
 #include "cache.h"
 #include "alpm.h"
 
-pmdb_t *_alpm_db_new(char *root, char* dbpath, char *treename)
+pmdb_t *_alpm_db_new(const char *root, const char *dbpath, const char *treename)
 {
 	pmdb_t *db;
 
@@ -150,7 +150,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, alpm_list_t *needles)
 	return(ret);
 }
 
-pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback)
+pmdb_t *_alpm_db_register(const char *treename, alpm_cb_db_register callback)
 {
 	struct stat buf;
 	pmdb_t *db;
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 9c4645f8..008ff669 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -47,18 +47,18 @@ struct __pmdb_t {
 };
 
 /* db.c, database general calls */
-pmdb_t *_alpm_db_new(char *root, char *dbpath, char *treename);
+pmdb_t *_alpm_db_new(const char *root, const char *dbpath, const char *treename);
 void _alpm_db_free(void *data);
 int _alpm_db_cmp(const void *db1, const void *db2);
 alpm_list_t *_alpm_db_search(pmdb_t *db, alpm_list_t *needles);
-pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback);
+pmdb_t *_alpm_db_register(const char *treename, alpm_cb_db_register callback);
 
 /* be.c, backend specific calls */
 int _alpm_db_install(pmdb_t *db, const char *dbfile);
 int _alpm_db_open(pmdb_t *db);
 void _alpm_db_close(pmdb_t *db);
 void _alpm_db_rewind(pmdb_t *db);
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq);
+pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target, pmdbinfrq_t inforeq);
 int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
 int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
 int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index d6aabaca..d1d79db4 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -150,7 +150,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
 				for(k = i->next; k; k = k->next) {
 					q = (pmpkg_t *)k->data;
 					if(!strcmp(dep.name, q->name)) {
-						if(!_alpm_pkg_isin(q->name, tmptargs)) {
+						if(!_alpm_pkg_find(q->name, tmptargs)) {
 							change = 1;
 							tmptargs = alpm_list_add(tmptargs, q);
 						}
@@ -158,7 +158,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
 					}
 					for(l = q->provides; l; l = l->next) {
 						if(!strcmp(dep.name, (char*)l->data)) {
-							if(!_alpm_pkg_isin((char*)l->data, tmptargs)) {
+							if(!_alpm_pkg_find((char*)l->data, tmptargs)) {
 								change = 1;
 								tmptargs = alpm_list_add(tmptargs, q);
 							}
@@ -167,7 +167,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
 					}
 				}
 			}
-			if(!_alpm_pkg_isin(p->name, tmptargs)) {
+			if(!_alpm_pkg_find(p->name, tmptargs)) {
 				tmptargs = alpm_list_add(tmptargs, p);
 			}
 		}
@@ -231,7 +231,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
 					/* hmmm... package isn't installed.. */
 					continue;
 				}
-				if(_alpm_pkg_isin(p->name, packages)) {
+				if(_alpm_pkg_find(p->name, packages)) {
 					/* this package also in the upgrade list, so don't worry about it */
 					continue;
 				}
@@ -443,7 +443,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets)
 {
 	alpm_list_t *i;
 
-	if(_alpm_pkg_isin(pkg->name, targets)) {
+	if(_alpm_pkg_find(pkg->name, targets)) {
 		return(0);
 	}
 
@@ -456,7 +456,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets)
 	/* see if other packages need it */
 	for(i = alpm_pkg_get_requiredby(pkg); i; i = i->next) {
 		pmpkg_t *reqpkg = _alpm_db_get_pkgfromcache(db, i->data);
-		if(reqpkg && !_alpm_pkg_isin(reqpkg->name, targets)) {
+		if(reqpkg && !_alpm_pkg_find(reqpkg->name, targets)) {
 			return(0);
 		}
 	}
@@ -606,14 +606,14 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
 			pm_errno = PM_ERR_UNSATISFIED_DEPS;
 			goto error;
 		}
-		if(_alpm_pkg_isin(sync->name, list)) {
+		if(_alpm_pkg_find(sync->name, list)) {
 			/* this dep is already in the target list */
 			_alpm_log(PM_LOG_DEBUG, _("dependency %s is already in the target list -- skipping"),
 			          sync->name);
 			continue;
 		}
 
-		if(!_alpm_pkg_isin(sync->name, trail)) {
+		if(!_alpm_pkg_find(sync->name, trail)) {
 			/* check pmo_ignorepkg and pmo_s_ignore to make sure we haven't pulled in
 			 * something we're not supposed to.
 			 */
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index 2068b02a..98b331f3 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -84,7 +84,7 @@ const char SYMEXPORT *alpm_grp_get_name(pmgrp_t *grp)
 	return grp->name;
 }
 
-alpm_list_t SYMEXPORT *alpm_grp_get_packages(pmgrp_t *grp)
+alpm_list_t SYMEXPORT *alpm_grp_get_pkgs(pmgrp_t *grp)
 {
 	ALPM_LOG_FUNC;
 
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 72d2b751..fbacda5e 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -182,12 +182,12 @@ int _alpm_pkg_cmp(const void *p1, const void *p2)
  * Returns: 0 on success, 1 on error
  *
  */
-static int parse_descfile(char *descfile, pmpkg_t *info)
+static int parse_descfile(const char *descfile, pmpkg_t *info)
 {
 	FILE* fp = NULL;
 	char line[PATH_MAX];
-	char* ptr = NULL;
-	char* key = NULL;
+	char *ptr = NULL;
+	char *key = NULL;
 	int linenum = 0;
 
 	ALPM_LOG_FUNC;
@@ -278,7 +278,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info)
 	return(0);
 }
 
-pmpkg_t *_alpm_pkg_load(char *pkgfile)
+pmpkg_t *_alpm_pkg_load(const char *pkgfile)
 {
 	char *expath;
 	int ret = ARCHIVE_OK;
@@ -453,7 +453,7 @@ error:
 /* Test for existence of a package in a alpm_list_t*
  * of pmpkg_t*
  */
-pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack)
+pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack)
 {
 	alpm_list_t *lp;
 
@@ -473,9 +473,10 @@ pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack)
 	return(NULL);
 }
 
-int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
+int _alpm_pkg_splitname(const char *target, char *name, char *version, int witharch)
 {
 	char tmp[PKG_FULLNAME_LEN+7];
+	const char *t;
 	char *p, *q;
 
 	ALPM_LOG_FUNC;
@@ -485,12 +486,12 @@ int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
 	}
 
 	/* trim path name (if any) */
-	if((p = strrchr(target, '/')) == NULL) {
-		p = target;
+	if((t = strrchr(target, '/')) == NULL) {
+		t = target;
 	} else {
-		p++;
+		t++;
 	}
-	STRNCPY(tmp, p, PKG_FULLNAME_LEN+7);
+	STRNCPY(tmp, t, PKG_FULLNAME_LEN+7);
 	/* trim file extension (if any) */
 	if((p = strstr(tmp, PM_EXT_PKG))) {
 		*p = '\0';
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 820a476f..f849ba85 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -103,9 +103,9 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
 void _alpm_pkg_free(void *data);
 int _alpm_pkg_cmp(const void *p1, const void *p2);
 int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
-pmpkg_t *_alpm_pkg_load(char *pkgfile);
-pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack);
-int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
+pmpkg_t *_alpm_pkg_load(const char *pkgfile);
+pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
+int _alpm_pkg_splitname(const char *target, char *name, char *version, int witharch);
 int _alpm_pkg_istoonew(pmpkg_t *pkg);
 void _alpm_pkg_update_requiredby(pmpkg_t *pkg);
 
diff --git a/lib/libalpm/provide.c b/lib/libalpm/provide.c
index 6ddc894c..dce1c267 100644
--- a/lib/libalpm/provide.c
+++ b/lib/libalpm/provide.c
@@ -31,7 +31,7 @@
 
 /* return a alpm_list_t of packages in "db" that provide "package"
  */
-alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, char *package)
+alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package)
 {
 	alpm_list_t *pkgs = NULL;
 	alpm_list_t *lp;
diff --git a/lib/libalpm/provide.h b/lib/libalpm/provide.h
index 7f249fff..b5c55db3 100644
--- a/lib/libalpm/provide.h
+++ b/lib/libalpm/provide.h
@@ -25,7 +25,7 @@
 #include "alpm_list.h"
 #include "config.h"
 
-alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, char *package);
+alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package);
 
 #endif /* _ALPM_PROVIDE_H */
 
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 3cd70dc0..0fd08732 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -69,7 +69,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_isin(name, trans->packages)) {
+	if(_alpm_pkg_find(name, trans->packages)) {
 		RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
 	}
 
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index b6150a5a..0e4c6c04 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -221,7 +221,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
 			for(j = trans->packages; j && !replace; j=j->next) {
 				sync = j->data;
 				if(sync->type == PM_SYNC_TYPE_REPLACE) {
-					if(_alpm_pkg_isin(spkg->name, sync->data)) {
+					if(_alpm_pkg_find(spkg->name, sync->data)) {
 						replace=1;
 					}
 				}
@@ -501,7 +501,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
 				for(j = trans->packages; j && !found; j = j->next) {
 					sync = j->data;
 					if(sync->type == PM_SYNC_TYPE_REPLACE) {
-						if(_alpm_pkg_isin(miss->depend.name, sync->data)) {
+						if(_alpm_pkg_find(miss->depend.name, sync->data)) {
 							found = 1;
 						}
 					}
@@ -929,7 +929,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
 			alpm_list_t *j;
 			for(j = sync->data; j; j = j->next) {
 				pmpkg_t *pkg = j->data;
-				if(!_alpm_pkg_isin(pkg->name, tr->packages)) {
+				if(!_alpm_pkg_find(pkg->name, tr->packages)) {
 					if(_alpm_trans_addtarget(tr, pkg->name) == -1) {
 						goto error;
 					}
@@ -1072,7 +1072,7 @@ pmsynctype_t SYMEXPORT alpm_sync_get_type(pmsyncpkg_t *sync)
 	return sync->type;
 }
 
-pmpkg_t SYMEXPORT *alpm_sync_get_package(pmsyncpkg_t *sync)
+pmpkg_t SYMEXPORT *alpm_sync_get_pkg(pmsyncpkg_t *sync)
 {
 	/* Sanity checks */
 	ASSERT(sync != NULL, return(NULL));
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 0bbc260e..334cb4a4 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -270,7 +270,7 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg)
 		}
 
 		if(trans->packages && trans->type == PM_TRANS_TYPE_REMOVE) {
-			if(_alpm_pkg_isin(dep.name, handle->trans->packages)) {
+			if(_alpm_pkg_find(dep.name, handle->trans->packages)) {
 				continue;
 			}
 		}
@@ -364,7 +364,7 @@ alpm_list_t * alpm_trans_get_targets()
 	return handle->trans->targets;
 }
 
-alpm_list_t SYMEXPORT * alpm_trans_get_packages()
+alpm_list_t SYMEXPORT * alpm_trans_get_pkgs()
 {
 	/* Sanity checks */
 	ASSERT(handle != NULL, return(NULL));