summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/add.c2
-rw-r--r--lib/libalpm/alpm.h7
-rw-r--r--lib/libalpm/deps.c12
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/package.h1
-rw-r--r--lib/libalpm/remove.c10
-rw-r--r--lib/libalpm/sync.c20
7 files changed, 30 insertions, 24 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index edddc318..ecdccff0 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -67,7 +67,7 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname);
- if(_alpm_pkg_find(trans->add, pkgname)) {
+ if(alpm_pkg_find(trans->add, pkgname)) {
RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
}
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 8d6edb81..d2d6055d 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -689,6 +689,13 @@ alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
alpm_siglevel_t level, alpm_pkg_t **pkg);
+/** Find a package in a list by name.
+ * @param haystack a list of alpm_pkg_t
+ * @param needle the package name
+ * @return a pointer to the package if found or NULL
+ */
+alpm_pkg_t *alpm_pkg_find(alpm_list_t *haystack, const char *needle);
+
/** Free a package.
* @param pkg package pointer to free
* @return 0 on success, -1 on error (pm_errno is set accordingly)
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 6841097d..404738dd 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -281,7 +281,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
for(i = pkglist; i; i = i->next) {
alpm_pkg_t *pkg = i->data;
- if(_alpm_pkg_find(rem, pkg->name) || _alpm_pkg_find(upgrade, pkg->name)) {
+ if(alpm_pkg_find(rem, pkg->name) || alpm_pkg_find(upgrade, pkg->name)) {
modified = alpm_list_add(modified, pkg);
} else {
dblist = alpm_list_add(dblist, pkg);
@@ -495,7 +495,7 @@ static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
{
alpm_list_t *i;
- if(_alpm_pkg_find(targets, pkg->name)) {
+ if(alpm_pkg_find(targets, pkg->name)) {
return 0;
}
@@ -517,7 +517,7 @@ static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
/* see if other packages need it */
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
alpm_pkg_t *lpkg = i->data;
- if(_alpm_dep_edge(lpkg, pkg) && !_alpm_pkg_find(targets, lpkg->name)) {
+ if(_alpm_dep_edge(lpkg, pkg) && !alpm_pkg_find(targets, lpkg->name)) {
return 0;
}
}
@@ -591,7 +591,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
for(i = dbs; i; i = i->next) {
alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
if(pkg && _alpm_depcmp_literal(pkg, dep)
- && !_alpm_pkg_find(excluding, pkg->name)) {
+ && !alpm_pkg_find(excluding, pkg->name)) {
if(_alpm_pkg_should_ignore(handle, pkg)) {
int install = 0;
if(prompt) {
@@ -616,7 +616,7 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
/* with hash != hash, we can even skip the strcmp() as we know they can't
* possibly be the same string */
if(pkg->name_hash != dep->name_hash && _alpm_depcmp(pkg, dep)
- && !_alpm_pkg_find(excluding, pkg->name)) {
+ && !alpm_pkg_find(excluding, pkg->name)) {
if(_alpm_pkg_should_ignore(handle, pkg)) {
int install = 0;
if(prompt) {
@@ -730,7 +730,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
alpm_list_t *deps = NULL;
alpm_list_t *packages_copy;
- if(_alpm_pkg_find(*packages, pkg->name) != NULL) {
+ if(alpm_pkg_find(*packages, pkg->name) != NULL) {
return 0;
}
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index f3e0b7fa..853771f8 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -685,7 +685,7 @@ int _alpm_pkg_cmp(const void *p1, const void *p2)
/* Test for existence of a package in a alpm_list_t*
* of alpm_pkg_t*
*/
-alpm_pkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
+alpm_pkg_t SYMEXPORT *alpm_pkg_find(alpm_list_t *haystack, const char *needle)
{
alpm_list_t *lp;
unsigned long needle_hash;
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 313fe9dd..a915bc33 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -140,7 +140,6 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
int _alpm_pkg_cmp(const void *p1, const void *p2);
int _alpm_pkg_compare_versions(alpm_pkg_t *local_pkg, alpm_pkg_t *pkg);
-alpm_pkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle);
int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg);
#endif /* _ALPM_PACKAGE_H */
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 0a4a5f97..dafbe283 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -68,7 +68,7 @@ int SYMEXPORT alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
pkgname = pkg->name;
- if(_alpm_pkg_find(trans->remove, pkgname)) {
+ if(alpm_pkg_find(trans->remove, pkgname)) {
RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
}
@@ -100,7 +100,7 @@ static int remove_prepare_cascade(alpm_handle_t *handle, alpm_list_t *lp)
alpm_pkg_t *info = _alpm_db_get_pkgfromcache(handle->db_local, miss->target);
if(info) {
alpm_pkg_t *copy;
- if(!_alpm_pkg_find(trans->remove, info->name)) {
+ if(!alpm_pkg_find(trans->remove, info->name)) {
_alpm_log(handle, ALPM_LOG_DEBUG, "pulling %s in target list\n",
info->name);
if(_alpm_pkg_dup(info, &copy) == -1) {
@@ -137,7 +137,7 @@ static void remove_prepare_keep_needed(alpm_handle_t *handle, alpm_list_t *lp)
for(i = lp; i; i = i->next) {
alpm_depmissing_t *miss = i->data;
void *vpkg;
- alpm_pkg_t *pkg = _alpm_pkg_find(trans->remove, miss->causingpkg);
+ alpm_pkg_t *pkg = alpm_pkg_find(trans->remove, miss->causingpkg);
if(pkg == NULL) {
continue;
}
@@ -171,11 +171,11 @@ static void remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *
alpm_pkg_t *pkg = i->data;
alpm_list_t *optdeps = alpm_pkg_get_optdepends(pkg);
- if(optdeps && !_alpm_pkg_find(lp, pkg->name)) {
+ if(optdeps && !alpm_pkg_find(lp, pkg->name)) {
alpm_list_t *j;
for(j = optdeps; j; j = alpm_list_next(j)) {
alpm_depend_t *optdep = j->data;
- if(_alpm_pkg_find(lp, optdep->name)) {
+ if(alpm_pkg_find(lp, optdep->name)) {
EVENT(handle, ALPM_EVENT_OPTDEP_REQUIRED, pkg, optdep);
}
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index ca6b507e..841e5d6f 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -159,7 +159,7 @@ static alpm_list_t *check_replacers(alpm_handle_t *handle, alpm_pkg_t *lpkg,
/* If spkg is already in the target list, we append lpkg to spkg's
* removes list */
- tpkg = _alpm_pkg_find(handle->trans->add, spkg->name);
+ tpkg = alpm_pkg_find(handle->trans->add, spkg->name);
if(tpkg) {
/* sanity check, multiple repos can contain spkg->name */
if(tpkg->origin_data.db != sdb) {
@@ -204,7 +204,7 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = i->next) {
alpm_pkg_t *lpkg = i->data;
- if(_alpm_pkg_find(trans->add, lpkg->name)) {
+ if(alpm_pkg_find(trans->add, lpkg->name)) {
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is already in the target list -- skipping\n", lpkg->name);
continue;
}
@@ -257,7 +257,7 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
for(j = grp->packages; j; j = j->next) {
alpm_pkg_t *pkg = j->data;
- if(_alpm_pkg_find(ignorelist, pkg->name)) {
+ if(alpm_pkg_find(ignorelist, pkg->name)) {
continue;
}
if(_alpm_pkg_should_ignore(db->handle, pkg)) {
@@ -268,7 +268,7 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
if(!install)
continue;
}
- if(!_alpm_pkg_find(pkgs, pkg->name)) {
+ if(!alpm_pkg_find(pkgs, pkg->name)) {
pkgs = alpm_list_add(pkgs, pkg);
}
}
@@ -448,7 +448,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
/* Set DEPEND reason for pulled packages */
for(i = resolved; i; i = i->next) {
alpm_pkg_t *pkg = i->data;
- if(!_alpm_pkg_find(trans->add, pkg->name)) {
+ if(!alpm_pkg_find(trans->add, pkg->name)) {
pkg->reason = ALPM_PKG_REASON_DEPEND;
}
}
@@ -482,8 +482,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
alpm_pkg_t *rsync, *sync, *sync1, *sync2;
/* have we already removed one of the conflicting targets? */
- sync1 = _alpm_pkg_find(trans->add, conflict->package1);
- sync2 = _alpm_pkg_find(trans->add, conflict->package2);
+ sync1 = alpm_pkg_find(trans->add, conflict->package1);
+ sync2 = alpm_pkg_find(trans->add, conflict->package2);
if(!sync1 || !sync2) {
continue;
}
@@ -545,7 +545,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
int found = 0;
for(j = trans->add; j && !found; j = j->next) {
alpm_pkg_t *spkg = j->data;
- if(_alpm_pkg_find(spkg->removes, conflict->package2)) {
+ if(alpm_pkg_find(spkg->removes, conflict->package2)) {
found = 1;
}
}
@@ -556,7 +556,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
_alpm_log(handle, ALPM_LOG_DEBUG, "package '%s' conflicts with '%s'\n",
conflict->package1, conflict->package2);
- alpm_pkg_t *sync = _alpm_pkg_find(trans->add, conflict->package1);
+ alpm_pkg_t *sync = alpm_pkg_find(trans->add, conflict->package1);
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, conflict->package2);
int doremove = 0;
QUESTION(handle, ALPM_QUESTION_CONFLICT_PKG, conflict->package1,
@@ -590,7 +590,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
alpm_pkg_t *spkg = i->data;
for(j = spkg->removes; j; j = j->next) {
alpm_pkg_t *rpkg = j->data;
- if(!_alpm_pkg_find(trans->remove, rpkg->name)) {
+ if(!alpm_pkg_find(trans->remove, rpkg->name)) {
alpm_pkg_t *copy;
_alpm_log(handle, ALPM_LOG_DEBUG, "adding '%s' to remove list\n", rpkg->name);
if(_alpm_pkg_dup(rpkg, &copy) == -1) {