summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/add.c6
-rw-r--r--lib/libalpm/alpm.c2
-rw-r--r--lib/libalpm/alpm_list.c8
-rw-r--r--lib/libalpm/alpm_list.h4
-rw-r--r--lib/libalpm/cache.c4
-rw-r--r--lib/libalpm/conflict.c7
-rw-r--r--lib/libalpm/deps.c6
-rw-r--r--lib/libalpm/provide.c2
-rw-r--r--lib/libalpm/remove.c5
-rw-r--r--lib/libalpm/server.c2
-rw-r--r--lib/libalpm/sync.c14
-rw-r--r--lib/libalpm/trans.c2
-rw-r--r--lib/libalpm/versioncmp.c3
-rw-r--r--src/pacman/sync.c4
14 files changed, 36 insertions, 33 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 38c0c9aa..678da620 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -507,7 +507,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
* eg, /home/httpd/html/index.html may be removed so index.php
* could be used.
*/
- if(alpm_list_is_strin(pathname, handle->noextract)) {
+ if(alpm_list_find_str(handle->noextract, pathname)) {
alpm_logaction(_("notice: %s is in NoExtract -- skipping extraction"), pathname);
archive_read_data_skip (archive);
continue;
@@ -516,7 +516,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
if(!stat(expath, &buf) && !S_ISDIR(buf.st_mode)) {
/* file already exists */
if(!pmo_upgrade || oldpkg == NULL) {
- nb = alpm_list_is_strin(pathname, info->backup);
+ nb = alpm_list_find_str(info->backup, pathname);
} else {
/* op == PM_TRANS_TYPE_UPGRADE */
md5_orig = _alpm_needbackup(pathname, oldpkg->backup);
@@ -525,7 +525,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
nb = 1;
}
}
- if(alpm_list_is_strin(pathname, handle->noupgrade)) {
+ if(alpm_list_find_str(handle->noupgrade, pathname)) {
notouch = 1;
nb = 0;
}
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 3c06971e..a347d74b 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -265,7 +265,7 @@ int alpm_db_update(int force, pmdb_t *db)
ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
- if(!alpm_list_is_in(db, handle->dbs_sync)) {
+ if(!alpm_list_find(handle->dbs_sync, db)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
index edb2e8e5..d553499e 100644
--- a/lib/libalpm/alpm_list.c
+++ b/lib/libalpm/alpm_list.c
@@ -309,7 +309,7 @@ alpm_list_t *alpm_list_remove_dupes(alpm_list_t *list)
{ /* TODO does removing the strdup here cause invalid free's anywhere? */
alpm_list_t *lp = list, *newlist = NULL;
while(lp) {
- if(!alpm_list_is_in(lp->data, newlist)) {
+ if(!alpm_list_find(newlist, lp->data)) {
newlist = alpm_list_add(newlist, lp->data);
}
lp = lp->next;
@@ -426,7 +426,7 @@ int alpm_list_count(const alpm_list_t *list)
* @param haystack the list to search
* @return 1 if `needle` is found, 0 otherwise
*/
-int alpm_list_is_in(const void *needle, alpm_list_t *haystack)
+int alpm_list_find(alpm_list_t *haystack, const void *needle)
{
alpm_list_t *lp = haystack;
while(lp) {
@@ -440,12 +440,12 @@ int alpm_list_is_in(const void *needle, alpm_list_t *haystack)
/* Test for existence of a string in a alpm_list_t
*/
-/** Is a _string_ in the list (optimization of alpm_list_is_in for strings)
+/** Is a _string_ in the list (optimization of alpm_list_find for strings)
* @param needle the string to compare
* @param haystack the list to search
* @return 1 if `needle` is found, 0 otherwise
*/
-int alpm_list_is_strin(const char *needle, alpm_list_t *haystack)
+int alpm_list_find_str(alpm_list_t *haystack, const char *needle)
{
alpm_list_t *lp = haystack;
while(lp) {
diff --git a/lib/libalpm/alpm_list.h b/lib/libalpm/alpm_list.h
index 5bad4dc2..5798558b 100644
--- a/lib/libalpm/alpm_list.h
+++ b/lib/libalpm/alpm_list.h
@@ -64,8 +64,8 @@ void *alpm_list_getdata(const alpm_list_t *entry);
/* misc */
int alpm_list_count(const alpm_list_t *list);
-int alpm_list_is_in(const void *needle, alpm_list_t *haystack);
-int alpm_list_is_strin(const char *needle, alpm_list_t *haystack);
+int alpm_list_find(alpm_list_t *haystack, const void *needle);
+int alpm_list_find_str(alpm_list_t *haystack,const char *needle);
#endif /* _ALPM_LIST_H */
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 81737d3c..61633a1a 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -202,7 +202,7 @@ int _alpm_db_load_grpcache(pmdb_t *db)
pmpkg_t *pkg = lp->data;
for(i = pkg->groups; i; i = i->next) {
- if(!alpm_list_is_strin(i->data, db->grpcache)) {
+ if(!alpm_list_find_str(db->grpcache, i->data)) {
pmgrp_t *grp = _alpm_grp_new();
STRNCPY(grp->name, (char *)i->data, GRP_NAME_LEN);
@@ -215,7 +215,7 @@ int _alpm_db_load_grpcache(pmdb_t *db)
pmgrp_t *grp = j->data;
if(strcmp(grp->name, i->data) == 0) {
- if(!alpm_list_is_strin(pkg->name, grp->packages)) {
+ if(!alpm_list_find_str(grp->packages, pkg->name)) {
grp->packages = alpm_list_add_sorted(grp->packages, (char *)pkg->name, _alpm_grp_cmp);
}
}
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 58ffb726..0191a187 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -240,7 +240,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, a
if(strcmp(filestr, ".INSTALL") == 0) {
continue;
}
- if(alpm_list_is_strin(filestr, p2->files)) {
+ if(alpm_list_find_str(p2->files, filestr)) {
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
if(conflict == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
@@ -284,7 +284,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, a
_alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), dbpkg->name);
_alpm_db_read(db, INFRQ_FILES, dbpkg);
}
- if(dbpkg && alpm_list_is_strin(j->data, dbpkg->files)) {
+ if(dbpkg && alpm_list_find_str(dbpkg->files, j->data)) {
ok = 1;
}
/* Make sure that the supposedly-conflicting file is not actually just
@@ -315,7 +315,8 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, a
_alpm_db_read(db, INFRQ_FILES, dbpkg2);
}
/* If it used to exist in there, but doesn't anymore */
- if(dbpkg2 && !alpm_list_is_strin(filestr, p1->files) && alpm_list_is_strin(filestr, dbpkg2->files)) {
+ if(dbpkg2 && !alpm_list_find_str(p1->files, filestr)
+ && alpm_list_find_str(dbpkg2->files, filestr)) {
ok = 1;
/* Add to the "skip list" of files that we shouldn't remove during an upgrade.
*
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 607dd673..0b4af443 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -363,7 +363,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
spkg = k->data;
}
if(spkg) {
- if(alpm_list_is_strin(tp->name, spkg->provides)) {
+ if(alpm_list_find_str(spkg->provides, tp->name)) {
found = 1;
}
}
@@ -549,7 +549,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
/* check if one of the packages in *list already provides this dependency */
for(j = list; j && !found; j = j->next) {
pmpkg_t *sp = (pmpkg_t *)j->data;
- if(alpm_list_is_strin(miss->depend.name, sp->provides)) {
+ if(alpm_list_find_str(sp->provides, miss->depend.name)) {
_alpm_log(PM_LOG_DEBUG, _("%s provides dependency %s -- skipping"),
sp->name, miss->depend.name);
found = 1;
@@ -602,7 +602,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
* something we're not supposed to.
*/
int usedep = 1;
- if(alpm_list_is_strin(sync->name, handle->ignorepkg)) {
+ if(alpm_list_find_str(handle->ignorepkg, sync->name)) {
pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep);
FREEPKG(dummypkg);
diff --git a/lib/libalpm/provide.c b/lib/libalpm/provide.c
index 91f827fb..0624d057 100644
--- a/lib/libalpm/provide.c
+++ b/lib/libalpm/provide.c
@@ -42,7 +42,7 @@ alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, char *package)
for(lp = _alpm_db_get_pkgcache(db, INFRQ_DEPENDS); lp; lp = lp->next) {
pmpkg_t *info = lp->data;
- if(alpm_list_is_strin(package, info->provides)) {
+ if(alpm_list_find_str(info->provides, package)) {
pkgs = alpm_list_add(pkgs, info);
}
}
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 9896453f..8621db79 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -78,7 +78,8 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
/* ignore holdpkgs on upgrade */
- if((trans == handle->trans) && alpm_list_is_strin(info->name, handle->holdpkg)) {
+ if((trans == handle->trans)
+ && alpm_list_find_str(handle->holdpkg, info->name)) {
int resp = 0;
QUESTION(trans, PM_TRANS_CONV_REMOVE_HOLDPKG, info, NULL, NULL, &resp);
if(!resp) {
@@ -177,7 +178,7 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
FREE(checksum);
} if ( !nb && trans->type == PM_TRANS_TYPE_UPGRADE ) {
/* check noupgrade */
- if ( alpm_list_is_strin(file, handle->noupgrade) ) {
+ if ( alpm_list_find_str(handle->noupgrade, file) ) {
nb = 1;
}
}
diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c
index 6a6658f1..bfff9fdf 100644
--- a/lib/libalpm/server.c
+++ b/lib/libalpm/server.c
@@ -137,7 +137,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
snprintf(realfile, PATH_MAX, "%s/%s", localpath, fn);
snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
- if(alpm_list_is_strin(fn, complete)) {
+ if(alpm_list_find_str(complete, fn)) {
continue;
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 1fd7c3cd..301b4917 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -137,7 +137,7 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
pmpkg_t *lpkg = m->data;
if(strcmp(k->data, lpkg->name) == 0) {
_alpm_log(PM_LOG_DEBUG, _("checking replacement '%s' for package '%s'"), k->data, spkg->name);
- if(alpm_list_is_strin(lpkg->name, handle->ignorepkg)) {
+ if(alpm_list_find_str(handle->ignorepkg, lpkg->name)) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)"),
lpkg->name, lpkg->version, spkg->name, spkg->version);
} else {
@@ -235,7 +235,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
local->name, local->version, db->treename, spkg->version);
} else if(cmp == 0) {
/* versions are identical */
- } else if(alpm_list_is_strin(spkg->name, handle->ignorepkg)) {
+ } else if(alpm_list_find_str(handle->ignorepkg, spkg->name)) {
/* package should be ignored (IgnorePkg) */
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
local->name, local->version, spkg->version);
@@ -535,7 +535,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
local = _alpm_db_get_pkgfromcache(db_local, miss->depend.name);
/* check if this package also "provides" the package it's conflicting with
*/
- if(alpm_list_is_strin(miss->depend.name, sync->pkg->provides)) {
+ if(alpm_list_find_str(sync->pkg->provides, miss->depend.name)) {
/* so just treat it like a "replaces" item so the REQUIREDBY
* fields are inherited properly.
*/
@@ -559,8 +559,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
/* figure out which one was requested in targets. If they both were,
* then it's still an unresolvable conflict. */
- target = alpm_list_is_strin(miss->target, trans->targets);
- depend = alpm_list_is_strin(miss->depend.name, trans->targets);
+ target = alpm_list_find_str(trans->targets, miss->target);
+ depend = alpm_list_find_str(trans->targets, miss->depend.name);
if(depend && !target) {
_alpm_log(PM_LOG_DEBUG, _("'%s' is in the target list -- keeping it"),
miss->depend.name);
@@ -591,7 +591,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
_alpm_log(PM_LOG_DEBUG, _("resolving package '%s' conflict"), miss->target);
if(local) {
int doremove = 0;
- if(!alpm_list_is_strin(miss->depend.name, asked)) {
+ if(!alpm_list_find_str(asked, miss->depend.name)) {
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &doremove);
asked = alpm_list_add(asked, strdup(miss->depend.name));
if(doremove) {
@@ -1020,7 +1020,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
pmpkg_t *old = j->data;
/* merge lists */
for(k = old->requiredby; k; k = k->next) {
- if(!alpm_list_is_strin(k->data, new->requiredby)) {
+ if(!alpm_list_find_str(new->requiredby, k->data)) {
/* replace old's name with new's name in the requiredby's dependency list */
alpm_list_t *m;
pmpkg_t *depender = _alpm_db_get_pkgfromcache(db_local, k->data);
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 75d3489b..005fa243 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -116,7 +116,7 @@ int _alpm_trans_addtarget(pmtrans_t *trans, char *target)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- if(alpm_list_is_strin(target, trans->targets)) {
+ if(alpm_list_find_str(trans->targets, target)) {
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
}
diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c
index 8f7c7389..a5e0f36f 100644
--- a/lib/libalpm/versioncmp.c
+++ b/lib/libalpm/versioncmp.c
@@ -247,7 +247,8 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
{
int equal = 0;
- if(strcmp(pkg->name, dep->name) == 0 || alpm_list_is_strin(dep->name, pkg->provides)) {
+ if(strcmp(pkg->name, dep->name) == 0
+ || alpm_list_find_str(pkg->provides, dep->name)) {
if(dep->mod == PM_DEP_MOD_ANY) {
equal = 1;
} else {
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 6b1cb432..9054d5ee 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -159,7 +159,7 @@ static int sync_cleancache(int level)
/* TODO Do not remove the currently installed version EITHER */
if(!strcmp(name, n)) {
char *ptr = (alpm_pkg_vercmp(version, v) < 0) ? str : s;
- if(!alpm_list_is_strin(ptr, clean)) {
+ if(!alpm_list_find_str(clean, ptr)) {
clean = alpm_list_add(clean, strdup(ptr));
}
}
@@ -645,7 +645,7 @@ int pacman_sync(alpm_list_t *targets)
for(j = data; j; j = alpm_list_next(j)) {
pmpkg_t *p = alpm_list_getdata(j);
const char *pkgname = alpm_pkg_get_name(p);
- if(!alpm_list_is_strin(pkgname, list_remove)) {
+ if(!alpm_list_find_str(list_remove, pkgname)) {
list_remove = alpm_list_add(list_remove, strdup(pkgname));
}
}