Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/Makefile.am4
-rw-r--r--lib/libalpm/add.c44
-rw-r--r--lib/libalpm/add.h4
-rw-r--r--lib/libalpm/alpm.c103
-rw-r--r--lib/libalpm/alpm.h73
-rw-r--r--lib/libalpm/alpm_list.c429
-rw-r--r--lib/libalpm/alpm_list.h71
-rw-r--r--lib/libalpm/backup.c4
-rw-r--r--lib/libalpm/backup.h4
-rw-r--r--lib/libalpm/be_files.c26
-rw-r--r--lib/libalpm/cache.c36
-rw-r--r--lib/libalpm/cache.h6
-rw-r--r--lib/libalpm/conflict.c62
-rw-r--r--lib/libalpm/conflict.h4
-rw-r--r--lib/libalpm/db.c10
-rw-r--r--lib/libalpm/db.h8
-rw-r--r--lib/libalpm/deps.c86
-rw-r--r--lib/libalpm/deps.h12
-rw-r--r--lib/libalpm/group.c4
-rw-r--r--lib/libalpm/group.h2
-rw-r--r--lib/libalpm/handle.c36
-rw-r--r--lib/libalpm/handle.h14
-rw-r--r--lib/libalpm/list.c361
-rw-r--r--lib/libalpm/list.h60
-rw-r--r--lib/libalpm/package.c72
-rw-r--r--lib/libalpm/package.h24
-rw-r--r--lib/libalpm/provide.c14
-rw-r--r--lib/libalpm/provide.h4
-rw-r--r--lib/libalpm/remove.c36
-rw-r--r--lib/libalpm/remove.h4
-rw-r--r--lib/libalpm/server.c30
-rw-r--r--lib/libalpm/server.h8
-rw-r--r--lib/libalpm/sync.c128
-rw-r--r--lib/libalpm/sync.h8
-rw-r--r--lib/libalpm/trans.c16
-rw-r--r--lib/libalpm/trans.h10
-rw-r--r--lib/libalpm/util.c10
-rw-r--r--lib/libalpm/util.h2
-rw-r--r--lib/libalpm/versioncmp.c4
39 files changed, 916 insertions, 917 deletions
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index c5306d1f..77f092bb 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -12,7 +12,7 @@ TARGETS = md5driver.c \
md5.c \
sha1.c \
util.c \
- list.c \
+ alpm_list.c \
log.c \
error.c \
package.c \
@@ -35,7 +35,7 @@ TARGETS = md5driver.c \
lib_LTLIBRARIES = libalpm.la
-include_HEADERS = alpm.h
+include_HEADERS = alpm_list.h alpm.h
libalpm_la_SOURCES = $(TARGETS)
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 24fceba5..5f7c024c 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -39,7 +39,7 @@
#include <limits.h>
#include <libintl.h>
/* pacman */
-#include "list.h"
+#include "alpm_list.h"
#include "trans.h"
#include "util.h"
#include "error.h"
@@ -88,7 +88,7 @@ static int add_faketarget(pmtrans_t *trans, char *name)
} 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));
+ dummy->depends = alpm_list_add(dummy->depends, strdup(q+1));
} else {
_alpm_log(PM_LOG_ERROR, _("could not parse token %s"), p);
}
@@ -100,7 +100,7 @@ static int add_faketarget(pmtrans_t *trans, char *name)
}
/* add the package to the transaction */
- trans->packages = _alpm_list_add(trans->packages, dummy);
+ trans->packages = alpm_list_add(trans->packages, dummy);
return(0);
}
@@ -110,7 +110,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
pmpkg_t *info = NULL;
pmpkg_t *dummy;
char pkgname[PKG_NAME_LEN], pkgver[PKG_VERSION_LEN];
- pmlist_t *i;
+ alpm_list_t *i;
struct stat buf;
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -201,7 +201,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
/* add the package to the transaction */
- trans->packages = _alpm_list_add(trans->packages, info);
+ trans->packages = alpm_list_add(trans->packages, info);
return(0);
@@ -216,10 +216,10 @@ static int name_cmp(const void *p1, const void *p2)
return(strcmp(((pmpkg_t *)p1)->name, (const char *)p2));
}
-int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
+int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
{
- pmlist_t *lp = NULL, *i = NULL;
- pmlist_t *rmlist = NULL;
+ alpm_list_t *lp = NULL, *i = NULL;
+ alpm_list_t *rmlist = NULL;
char rm_fname[PATH_MAX];
pmpkg_t *info = NULL;
@@ -254,7 +254,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &skip_this);
if(skip_this) {
pmpkg_t **pkg = NULL;
- lp = _alpm_list_remove(lp, (void *)miss->depend.name, name_cmp, (void **)pkg);
+ lp = alpm_list_remove(lp, (void *)miss->depend.name, name_cmp, (void **)pkg);
FREEPKG(*pkg);
}
}
@@ -293,7 +293,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
/* Check for file conflicts
*/
if(!(trans->flags & PM_TRANS_FLAG_FORCE)) {
- pmlist_t *skiplist = NULL;
+ alpm_list_t *skiplist = NULL;
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
@@ -334,7 +334,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
char expath[PATH_MAX], cwd[PATH_MAX] = "", *what;
unsigned char cb_state;
time_t t;
- pmlist_t *targ, *lp;
+ alpm_list_t *targ, *lp;
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
@@ -375,7 +375,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), local->name);
_alpm_db_read(db, INFRQ_FILES, local);
}
- oldpkg->backup = _alpm_list_strdup(local->backup);
+ oldpkg->backup = alpm_list_strdup(local->backup);
strncpy(oldpkg->name, local->name, PKG_NAME_LEN);
strncpy(oldpkg->version, local->version, PKG_VERSION_LEN);
}
@@ -408,7 +408,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
/* copy the skiplist over */
- tr->skiplist = _alpm_list_strdup(trans->skiplist);
+ tr->skiplist = alpm_list_strdup(trans->skiplist);
if(_alpm_remove_commit(tr, db) == -1) {
FREETRANS(tr);
RET_ERR(PM_ERR_TRANS_ABORT, -1);
@@ -475,7 +475,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
if (info->size != 0)
percent = (double)archive_position_uncompressed(archive) / info->size;
if (needdisp == 0) {
- PROGRESS(trans, cb_state, what, (int)(percent * 100), _alpm_list_count(trans->packages), (_alpm_list_count(trans->packages) - _alpm_list_count(targ) +1));
+ PROGRESS(trans, cb_state, what, (int)(percent * 100), alpm_list_count(trans->packages), (alpm_list_count(trans->packages) - alpm_list_count(targ) +1));
}
if(!strcmp(pathname, ".PKGINFO") || !strcmp(pathname, ".FILELIST")) {
@@ -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_is_strin(pathname, handle->noextract)) {
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_is_strin(pathname, info->backup);
} 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_is_strin(pathname, handle->noupgrade)) {
notouch = 1;
nb = 0;
}
@@ -753,7 +753,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
* looking for packages depending on the package to add */
for(lp = _alpm_db_get_pkgcache(db, INFRQ_DEPENDS); lp; lp = lp->next) {
pmpkg_t *tmpp = lp->data;
- pmlist_t *tmppm = NULL;
+ alpm_list_t *tmppm = NULL;
if(tmpp == NULL) {
continue;
}
@@ -764,7 +764,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
}
if(tmppm->data && !strcmp(depend.name, info->name)) {
_alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), tmpp->name, info->name);
- info->requiredby = _alpm_list_add(info->requiredby, strdup(tmpp->name));
+ info->requiredby = alpm_list_add(info->requiredby, strdup(tmpp->name));
}
}
}
@@ -800,7 +800,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
depinfo = _alpm_db_get_pkgfromcache(db, depend.name);
if(depinfo == NULL) {
/* look for a provides package */
- pmlist_t *provides = _alpm_db_whatprovides(db, depend.name);
+ alpm_list_t *provides = _alpm_db_whatprovides(db, depend.name);
if(provides) {
/* TODO: should check _all_ packages listed in provides, not just
* the first one.
@@ -820,14 +820,14 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_db_read(db, INFRQ_DEPENDS, depinfo);
_alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), info->name, depinfo->name);
- depinfo->requiredby = _alpm_list_add(depinfo->requiredby, strdup(info->name));
+ depinfo->requiredby = alpm_list_add(depinfo->requiredby, strdup(info->name));
if(_alpm_db_write(db, depinfo, INFRQ_DEPENDS)) {
_alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s"),
depinfo->name, depinfo->version);
}
}
- PROGRESS(trans, cb_state, what, 100, _alpm_list_count(trans->packages), (_alpm_list_count(trans->packages) - _alpm_list_count(targ) +1));
+ PROGRESS(trans, cb_state, what, 100, alpm_list_count(trans->packages), (alpm_list_count(trans->packages) - alpm_list_count(targ) +1));
needdisp = 0;
EVENT(trans, PM_TRANS_EVT_EXTRACT_DONE, NULL, NULL);
FREE(what);
diff --git a/lib/libalpm/add.h b/lib/libalpm/add.h
index d39aa140..4cd2e445 100644
--- a/lib/libalpm/add.h
+++ b/lib/libalpm/add.h
@@ -22,11 +22,11 @@
#define _ALPM_ADD_H
#include "db.h"
-#include "list.h"
+#include "alpm_list.h"
#include "trans.h"
int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
-int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data);
+int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data);
int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db);
#endif /* _ALPM_ADD_H */
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index ae5f6686..c604f4f5 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -42,7 +42,7 @@
#include "versioncmp.h"
#include "md5.h"
#include "sha1.h"
-#include "list.h"
+#include "alpm_list.h"
#include "package.h"
#include "group.h"
#include "util.h"
@@ -169,7 +169,7 @@ int alpm_db_unregister(pmdb_t *db)
found = 1;
} else {
void *data;
- handle->dbs_sync = _alpm_list_remove(handle->dbs_sync, db, _alpm_db_cmp, &data);
+ handle->dbs_sync = alpm_list_remove(handle->dbs_sync, db, _alpm_db_cmp, &data);
if(data) {
found = 1;
}
@@ -209,7 +209,7 @@ int alpm_db_setserver(pmdb_t *db, const char *url)
found = 1;
}
} else {
- pmlist_t *i;
+ alpm_list_t *i;
for(i = handle->dbs_sync; i && !found; i = i->next) {
pmdb_t *sdb = i->data;
if(strcmp(db->treename, sdb->treename) == 0) {
@@ -227,7 +227,7 @@ int alpm_db_setserver(pmdb_t *db, const char *url)
/* pm_errno is set by _alpm_server_new */
return(-1);
}
- db->servers = _alpm_list_add(db->servers, server);
+ db->servers = alpm_list_add(db->servers, server);
_alpm_log(PM_LOG_FLOW2, _("adding new server to database '%s': protocol '%s', server '%s', path '%s'"),
db->treename, server->s_url->scheme, server->s_url->host, server->s_url->doc);
} else {
@@ -247,9 +247,9 @@ int alpm_db_setserver(pmdb_t *db, const char *url)
*/
int alpm_db_update(int force, pmdb_t *db)
{
- pmlist_t *lp;
+ alpm_list_t *lp;
char path[PATH_MAX];
- pmlist_t *files = NULL;
+ alpm_list_t *files = NULL;
char newmtime[16] = "";
char lastupdate[16] = "";
int ret;
@@ -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_is_in(db, handle->dbs_sync)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
@@ -279,7 +279,7 @@ int alpm_db_update(int force, pmdb_t *db)
/* build a one-element list */
snprintf(path, PATH_MAX, "%s" PM_EXT_DB, db->treename);
- files = _alpm_list_add(files, strdup(path));
+ files = alpm_list_add(files, strdup(path));
snprintf(path, PATH_MAX, "%s%s", handle->root, handle->dbpath);
@@ -344,7 +344,7 @@ pmpkg_t *alpm_db_readpkg(pmdb_t *db, char *name)
* @param db pointer to the package database to get the package from
* @return the list of packages on success, NULL on error
*/
-pmlist_t *alpm_db_getpkgcache(pmdb_t *db)
+alpm_list_t *alpm_db_getpkgcache(pmdb_t *db)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -358,7 +358,7 @@ pmlist_t *alpm_db_getpkgcache(pmdb_t *db)
* @param name name of the package
* @return the list of packages on success, NULL on error
*/
-pmlist_t *alpm_db_whatprovides(pmdb_t *db, char *name)
+alpm_list_t *alpm_db_whatprovides(pmdb_t *db, char *name)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -387,7 +387,7 @@ pmgrp_t *alpm_db_readgrp(pmdb_t *db, char *name)
* @param db pointer to the package database to get the group from
* @return the list of groups on success, NULL on error
*/
-pmlist_t *alpm_db_getgrpcache(pmdb_t *db)
+alpm_list_t *alpm_db_getgrpcache(pmdb_t *db)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -596,7 +596,7 @@ char *alpm_pkg_name_hasarch(char *pkgname)
* @param db pointer to the package database to search in
* @return the list of packages on success, NULL on error
*/
-pmlist_t *alpm_db_search(pmdb_t *db)
+alpm_list_t *alpm_db_search(pmdb_t *db)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -687,7 +687,7 @@ int alpm_trans_addtarget(char *target)
* of an error can be dumped (ie. list of conflicting files)
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_trans_prepare(pmlist_t **data)
+int alpm_trans_prepare(alpm_list_t **data)
{
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
@@ -704,7 +704,7 @@ int alpm_trans_prepare(pmlist_t **data)
* of an error can be dumped (ie. list of conflicting files)
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_trans_commit(pmlist_t **data)
+int alpm_trans_commit(alpm_list_t **data)
{
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
@@ -801,81 +801,6 @@ int alpm_logaction(char *fmt, ...)
}
/** @} */
-/** \addtogroup alpm_list List Functions
- * @brief Functions to manipulate libalpm linked lists
- * @{
- */
-
-/** Get the first element of a list.
- * @param list the list
- * @return the first element
- */
-pmlist_t *alpm_list_first(pmlist_t *list)
-{
- return(list);
-}
-
-/** Get the next element of a list.
- * @param entry the list entry
- * @return the next element on success, NULL on error
- */
-pmlist_t *alpm_list_next(pmlist_t *entry)
-{
- ASSERT(entry != NULL, return(NULL));
-
- return(entry->next);
-}
-
-/** Get the data of a list entry.
- * @param entry the list entry
- * @return the data on success, NULL on error
- */
-void *alpm_list_getdata(const pmlist_t *entry)
-{
- ASSERT(entry != NULL, return(NULL));
-
- return(entry->data);
-}
-
-/** Free a list.
- * @param entry list to free
- * @return 0 on success, -1 on error
- */
-int alpm_list_free(pmlist_t *entry)
-{
- ASSERT(entry != NULL, return(-1));
-
- FREELIST(entry);
-
- return(0);
-}
-
-/** Free the outer list, but not the contained data
- * @param entry list to free
- * @return 0 on success, -1 on error
- */
-int alpm_list_free_outer(pmlist_t *entry)
-{
- ASSERT(entry != NULL, return(-1));
-
- _FREELIST(entry, NULL);
-
- return(0);
-}
-
-/** Count the entries in a list.
- * @param list the list to count
- * @return number of entries on success, NULL on error
- */
-int alpm_list_count(const pmlist_t *list)
-{
- ASSERT(list != NULL, return(-1));
-
- return(_alpm_list_count(list));
-}
-
-/** @} */
-
/** \addtogroup alpm_misc Miscellaneous Functions
* @brief Various libalpm functions
* @{
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 143f3367..1a227224 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -47,7 +47,8 @@ extern "C" {
* Structures
*/
-typedef struct __pmlist_t pmlist_t;
+typedef struct __alpm_list_t alpm_list_t;
+
typedef struct __pmdb_t pmdb_t;
typedef struct __pmpkg_t pmpkg_t;
typedef struct __pmgrp_t pmgrp_t;
@@ -117,21 +118,21 @@ void alpm_option_set_logfile(const char *logfile);
unsigned char alpm_option_get_usesyslog();
void alpm_option_set_usesyslog(unsigned char usesyslog);
-pmlist_t *alpm_option_get_noupgrades();
+alpm_list_t *alpm_option_get_noupgrades();
void alpm_option_add_noupgrade(char *pkg);
-void alpm_option_set_noupgrades(pmlist_t *noupgrade);
+void alpm_option_set_noupgrades(alpm_list_t *noupgrade);
-pmlist_t *alpm_option_get_noextracts();
+alpm_list_t *alpm_option_get_noextracts();
void alpm_option_add_noextract(char *pkg);
-void alpm_option_set_noextracts(pmlist_t *noextract);
+void alpm_option_set_noextracts(alpm_list_t *noextract);
-pmlist_t *alpm_option_get_ignorepkgs();
+alpm_list_t *alpm_option_get_ignorepkgs();
void alpm_option_add_ignorepkg(char *pkg);
-void alpm_option_set_ignorepkgs(pmlist_t *ignorepkgs);
+void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs);
-pmlist_t *alpm_option_get_holdpkgs();
+alpm_list_t *alpm_option_get_holdpkgs();
void alpm_option_add_holdpkg(char *pkg);
-void alpm_option_set_holdpkgs(pmlist_t *holdpkgs);
+void alpm_option_set_holdpkgs(alpm_list_t *holdpkgs);
time_t alpm_option_get_upgradedelay();
void alpm_option_set_upgradedelay(time_t delay);
@@ -145,13 +146,16 @@ void alpm_option_set_nopassiveftp(unsigned short nopasv);
unsigned short alpm_option_get_chomp();
void alpm_option_set_chomp(unsigned short chomp);
-pmlist_t *alpm_option_get_needles();
+alpm_list_t *alpm_option_get_needles();
void alpm_option_add_needle(char *needle);
-void alpm_option_set_needles(pmlist_t *needles);
+void alpm_option_set_needles(alpm_list_t *needles);
unsigned short alpm_option_get_usecolor();
void alpm_option_set_usecolor(unsigned short usecolor);
+pmdb_t *alpm_option_get_localdb();
+alpm_list_t *alpm_option_get_syncdbs();
+
/*
* Databases
*/
@@ -170,12 +174,12 @@ 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);
-pmlist_t *alpm_db_getpkgcache(pmdb_t *db);
-pmlist_t *alpm_db_whatprovides(pmdb_t *db, char *name);
+alpm_list_t *alpm_db_getpkgcache(pmdb_t *db);
+alpm_list_t *alpm_db_whatprovides(pmdb_t *db, char *name);
pmgrp_t *alpm_db_readgrp(pmdb_t *db, char *name);
-pmlist_t *alpm_db_getgrpcache(pmdb_t *db);
-pmlist_t *alpm_db_search(pmdb_t *db);
+alpm_list_t *alpm_db_getgrpcache(pmdb_t *db);
+alpm_list_t *alpm_db_search(pmdb_t *db);
/*
* Packages
@@ -215,23 +219,23 @@ const char *alpm_pkg_get_arch(pmpkg_t *pkg);
unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
unsigned long alpm_pkg_get_isize(pmpkg_t *pkg);
unsigned char alpm_pkg_get_reason(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_groups(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_depends(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_removes(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_requiredby(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_conflicts(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_provides(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_replaces(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_files(pmpkg_t *pkg);
-pmlist_t *alpm_pkg_get_backup(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_removes(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_requiredby(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_conflicts(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_provides(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg);
+alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg);
unsigned char alpm_pkg_has_scriptlet(pmpkg_t *pkg);
/*
* Groups
*/
const char *alpm_grp_get_name(pmgrp_t *grp);
-pmlist_t *alpm_grp_get_packages(pmgrp_t *grp);
+alpm_list_t *alpm_grp_get_packages(pmgrp_t *grp);
/*
* Sync
@@ -334,13 +338,13 @@ typedef void (*alpm_trans_cb_progress)(unsigned char, char *, int, int, int);
unsigned char alpm_trans_get_type();
unsigned int alpm_trans_get_flags();
-pmlist_t * alpm_trans_get_targets();
-pmlist_t * alpm_trans_get_packages();
+alpm_list_t * alpm_trans_get_targets();
+alpm_list_t * alpm_trans_get_packages();
int alpm_trans_init(unsigned char type, unsigned int flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress);
int alpm_trans_sysupgrade(void);
int alpm_trans_addtarget(char *target);
-int alpm_trans_prepare(pmlist_t **data);
-int alpm_trans_commit(pmlist_t **data);
+int alpm_trans_prepare(alpm_list_t **data);
+int alpm_trans_commit(alpm_list_t **data);
int alpm_trans_release(void);
/*
@@ -382,15 +386,6 @@ const char *alpm_conflict_get_ctarget(pmconflict_t *conflict);
/*
* Helpers
*/
-
-/* pmlist_t */
-pmlist_t *alpm_list_first(pmlist_t *list);
-pmlist_t *alpm_list_next(pmlist_t *entry);
-#define alpm_list_data(type, list) (type)alpm_list_getdata((list))
-void *alpm_list_getdata(const pmlist_t *entry);
-int alpm_list_free(pmlist_t *entry);
-int alpm_list_free_outer(pmlist_t *entry);
-int alpm_list_count(const pmlist_t *list);
/* md5sums */
char *alpm_get_md5sum(char *name);
diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
new file mode 100644
index 00000000..beccc39c
--- /dev/null
+++ b/lib/libalpm/alpm_list.c
@@ -0,0 +1,429 @@
+/*
+ * alpm_list.c
+ *
+ * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include "alpm_list.h"
+#include "util.h"
+
+/** \defgroup alpm_list functions */
+/*\@{*/
+
+/* Allocation */
+
+/** Allocate a new alpm_list_t
+ * @return a new alpm_list_t item, or NULL on failure
+ */
+alpm_list_t *alpm_list_new()
+{
+ alpm_list_t *list = NULL;
+
+ list = (alpm_list_t *)malloc(sizeof(alpm_list_t));
+ if(list) {
+ list->data = NULL;
+ list->prev = NULL;
+ list->next = NULL;
+ }
+ return(list);
+}
+
+/** Free a list structure and possibly the internal data as well
+ * @param list the list to free
+ * @param fn a free function for the internal data, or NULL for none
+ */
+void alpm_list_free(alpm_list_t *list, alpm_list_fn_free fn)
+{
+ alpm_list_t *it = list;
+
+ while(it) {
+ alpm_list_t *ptr = it->next;
+ if(fn && it->data) {
+ fn(it->data);
+ }
+ FREE(it);
+ it = ptr;
+ }
+}
+
+/** Free the outer list, but not the contained data
+ * A minor simplification of alpm_list_free
+ * @param list the list to free
+ */
+void alpm_list_free_outer(alpm_list_t *list)
+{
+ alpm_list_free(list, NULL);
+}
+
+/* Mutators */
+
+/** Add a new item to the list
+ * @param list the list to add to
+ * @param data the new item to be added to the list
+ * @return the resultant list, or NULL on failure
+ */
+alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
+{
+ alpm_list_t *ptr, *lp;
+
+ ptr = list;
+ if(ptr == NULL) {
+ ptr = alpm_list_new();
+ if(ptr == NULL) {
+ return(NULL);
+ }
+ }
+
+ lp = alpm_list_last(ptr);
+ if(lp == ptr && lp->data == NULL) {
+ /* nada */
+ } else {
+ lp->next = alpm_list_new();
+ if(lp->next == NULL) {
+ return(NULL);
+ }
+ lp->next->prev = lp;
+ lp = lp->next;
+ }
+
+ lp->data = data;
+
+ return(ptr);
+}
+
+/** Add items to a list in sorted order.
+ * @param list the list to add to
+ * @param data the new item to be added to the list
+ * @param fn the comparison function to use to determine order
+ * @return the resultant list, or NULL on failure
+ */
+alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn)
+{
+ if(!fn) {
+ return alpm_list_add(list, data);
+ } else {
+ alpm_list_t *add = NULL, *prev = NULL, *next = list;
+
+ add = alpm_list_new();
+ add->data = data;
+
+ /* Find insertion point. */
+ while(next) {
+ if(fn(add->data, next->data) <= 0) break;
+ prev = next;
+ next = next->next;
+ }
+
+ /* Insert node before insertion point. */
+ add->prev = prev;
+ add->next = next;
+
+ if(next != NULL) {
+ next->prev = add; /* Not at end. */
+ }
+
+ if(prev != NULL) {
+ prev->next = add; /* In middle. */
+ }
+
+ return(list);
+ }
+}
+
+/** Merge the two sorted sublists into one sorted list
+ * @param left the first list
+ * @param right the second list
+ * @param fn comparison function for determining merge order
+ */
+alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)
+{
+ alpm_list_t *newlist, *lp;
+
+ if (left == NULL)
+ return right;
+ if (right == NULL)
+ return left;
+
+ if (fn(left->data, right->data) <= 0) {
+ newlist = left;
+ left = left->next;
+ }
+ else {
+ newlist = right;
+ right = right->next;
+ }
+ newlist->prev = NULL;
+ newlist->next = NULL;
+ lp = newlist;
+
+ while ((left != NULL) && (right != NULL)) {
+ if (fn(left->data, right->data) <= 0) {
+ lp->next = left;
+ left->prev = lp;
+ left = left->next;
+ }
+ else {
+ lp->next = right;
+ right->prev = lp;
+ right = right->next;
+ }
+ lp = lp->next;
+ lp->next = NULL;
+ }
+ if (left != NULL) {
+ lp->next = left;
+ left->prev = lp;
+ }
+ else if (right != NULL) {
+ lp->next = right;
+ right->prev = lp;
+ }
+ return(newlist);
+}
+
+/** Sort a list of size `n` using mergesort algorithm
+ * @param list the list to sort
+ * @param n the size of the list
+ * @param fn the comparison function for determining order
+ */
+alpm_list_t* alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn)
+{
+ if (n > 1) {
+ alpm_list_t *left = list;
+ alpm_list_t *lastleft = alpm_list_nth(list, n/2 - 1);
+ alpm_list_t *right = lastleft->next;
+ /* terminate first list */
+ lastleft->next = NULL;
+
+ left = alpm_list_msort(left, n/2, fn);
+ right = alpm_list_msort(right, n - (n/2), fn);
+ list = alpm_list_mmerge(left, right, fn);
+ }
+ return(list);
+}
+
+/** Remove an item from the list
+ * @param haystack the list to remove the item from
+ * @param needle the data member of the item we're removing
+ * @param fn the comparison function for searching
+ * @param data output parameter containing the data member of the item removed
+ * @return the resultant list, or NULL on failure
+ */
+alpm_list_t *alpm_list_remove(alpm_list_t *haystack, void *needle, alpm_list_fn_cmp fn, void **data)
+{ /* TODO I modified this to remove ALL matching items. Do we need a remove_first? */
+ alpm_list_t *i = haystack, *tmp = NULL;
+
+ if(data) {
+ *data = NULL;
+ }
+
+ while(i) {
+ if(i->data == NULL) {
+ continue;
+ }
+ tmp = i->next;
+ if(fn(needle, i->data) == 0) {
+ /* we found a matching item */
+ if(i->next) {
+ i->next->prev = i->prev;
+ }
+ if(i->prev) {
+ i->prev->next = i->next;
+ }
+
+ if(i == haystack) {
+ /* The item found is the first in the chain */
+ haystack = haystack->next;
+ }
+
+ if(data) {
+ *data = i->data;
+ }
+ i->data = NULL;
+ free(i);
+ }
+ i = tmp;
+ }
+
+ return(haystack);
+}
+
+/** Create a new list without any duplicates
+ * @note DOES NOT copy data members
+ * @param list the list to copy
+ * @return a NEW list containing non-duplicated items
+ */
+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)) {
+ newlist = alpm_list_add(newlist, lp->data);
+ }
+ lp = lp->next;
+ }
+ return(newlist);
+}
+
+/** Copy a string list, including data
+ * @note this is gross, assumes string data members
+ * @param list the list to copy
+ * @return a copy of the original list
+ */
+alpm_list_t *alpm_list_strdup(alpm_list_t *list)
+{
+ alpm_list_t *lp = list, *newlist = NULL;
+ while(lp) {
+ newlist = alpm_list_add(newlist, strdup(lp->data));
+ lp = lp->next;
+ }
+ return(newlist);
+}
+
+/** Create a new list in reverse order
+ * @param list the list to copy
+ * @return a NEW list in reverse order of the first
+ */
+alpm_list_t *alpm_list_reverse(alpm_list_t *list)
+{ /* TODO any invalid free's from NOT duplicating data here? */
+ alpm_list_t *lp, *newlist = NULL;
+
+ lp = alpm_list_last(list);
+ while(lp) {
+ newlist = alpm_list_add(newlist, lp->data);
+ lp = lp->prev;
+ }
+ return(newlist);
+}
+
+/* Accessors */
+
+/** Get the first element of a list.
+ * @param list the list
+ * @return the first element in the list
+ */
+alpm_list_t *alpm_list_first(alpm_list_t *list)
+{
+ return(list);
+}
+
+/** Return nth element from list (starting with 0)
+ * @param list the list to access
+ * @param n the index of the item to find
+ * @return an alpm_list_t node for index `n`
+ */
+alpm_list_t *alpm_list_nth(alpm_list_t *list, int n)
+{
+ alpm_list_t *i = list;
+ while(n--) {
+ i = i->next;
+ }
+ return(i);
+}
+
+/** Get the next element of a list.
+ * @param entry the list entry
+ * @return the next element, or NULL when no more elements exist
+ */
+alpm_list_t *alpm_list_next(alpm_list_t *entry)
+{
+ return(entry->next);
+}
+/** Get the last item in the list.
+ * @param list the list to operate on
+ * @return the last element in the list
+ */
+alpm_list_t *alpm_list_last(alpm_list_t *list)
+{
+ alpm_list_t *i = list;
+ while(i && i->next) {
+ i = i->next;
+ }
+ return(i);
+}
+
+/** Get the data member of a list entry.
+ * @param entry the list entry
+ * @return the contained data, or NULL if none
+ */
+void *alpm_list_getdata(const alpm_list_t *entry)
+{
+ return(entry->data);
+}
+
+/* Misc */
+
+/** Count the list items
+ * @param list the list to operate on
+ * @return the number of list items
+ */
+int alpm_list_count(const alpm_list_t *list)
+{
+ unsigned int i = 0;
+ const alpm_list_t *lp = list;
+ while(lp) {
+ ++i;
+ lp = lp->next;
+ }
+ return(i);
+}
+
+/** Is an item in the list
+ * @param needle the data to compare to (== comparison)
+ * @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)
+{
+ alpm_list_t *lp = haystack;
+ while(lp) {
+ if(lp->data == needle) {
+ return(1);
+ }
+ lp = lp->next;
+ }
+ return(0);
+}
+
+/* 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)
+ * @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)
+{
+ alpm_list_t *lp = haystack;
+ while(lp) {
+ if(lp->data && strcmp((const char *)lp->data, needle) == 0) {
+ return(1);
+ }
+ }
+ return(0);
+}
+
+/** @} */
+
+/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/alpm_list.h b/lib/libalpm/alpm_list.h
new file mode 100644
index 00000000..df19c9e9
--- /dev/null
+++ b/lib/libalpm/alpm_list.h
@@ -0,0 +1,71 @@
+/*
+ * alpm_alpm_list.h
+ *
+ * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ */
+#ifndef _ALPM_LIST_H
+#define _ALPM_LIST_H
+
+#include "alpm.h"
+
+/* Chained list struct */
+struct __alpm_list_t {
+ void *data;
+ struct __alpm_list_t *prev;
+ struct __alpm_list_t *next;
+};
+
+/* TODO we should do away with these... they're messy */
+#define _FREELIST(p, f) do { if(p) { alpm_list_free(p, f); p = NULL; } } while(0)
+#define FREELIST(p) _FREELIST(p, free)
+#define FREELISTPTR(p) _FREELIST(p, NULL)
+
+typedef void (*alpm_list_fn_free)(void *); /* item deallocation callback */
+typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */
+
+/* allocation */
+alpm_list_t *alpm_list_new(void);
+void alpm_list_free(alpm_list_t *list, alpm_list_fn_free fn);
+void alpm_list_free_outer(alpm_list_t *list);
+
+/* item mutators */
+alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
+alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
+alpm_list_t* alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
+alpm_list_t* alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn);
+alpm_list_t *alpm_list_remove(alpm_list_t *haystack, void *needle, alpm_list_fn_cmp fn, void **data);
+alpm_list_t *alpm_list_remove_dupes(alpm_list_t *list);
+alpm_list_t *alpm_list_strdup(alpm_list_t *list);
+alpm_list_t *alpm_list_reverse(alpm_list_t *list);
+
+/* item accessors */
+alpm_list_t *alpm_list_first(alpm_list_t *list);
+alpm_list_t* alpm_list_nth(alpm_list_t *list, int n);
+alpm_list_t *alpm_list_next(alpm_list_t *list);
+alpm_list_t *alpm_list_last(alpm_list_t *list);
+void *alpm_list_getdata(const alpm_list_t *entry);
+#define alpm_list_data(type, list) (type)alpm_list_getdata((list))
+
+/* 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);
+
+#endif /* _ALPM_LIST_H */
+
+/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c
index 4c438fe4..dbe6d625 100644
--- a/lib/libalpm/backup.c
+++ b/lib/libalpm/backup.c
@@ -32,9 +32,9 @@
/* Look for a filename in a pmpkg_t.backup list. If we find it,
* then we return the md5 or sha1 hash (parsed from the same line)
*/
-char *_alpm_needbackup(char *file, pmlist_t *backup)
+char *_alpm_needbackup(char *file, alpm_list_t *backup)
{
- pmlist_t *lp;
+ alpm_list_t *lp;
if(file == NULL || backup == NULL) {
return(NULL);
diff --git a/lib/libalpm/backup.h b/lib/libalpm/backup.h
index b1aa434c..0498146b 100644
--- a/lib/libalpm/backup.h
+++ b/lib/libalpm/backup.h
@@ -21,9 +21,9 @@
#ifndef _ALPM_BACKUP_H
#define _ALPM_BACKUP_H
-#include "list.h"
+#include "alpm_list.h"
-char *_alpm_needbackup(char *file, pmlist_t *backup);
+char *_alpm_needbackup(char *file, alpm_list_t *backup);
#endif /* _ALPM_BACKUP_H */
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index e722f626..ba3e45a4 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -181,7 +181,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
struct stat buf;
char path[PATH_MAX+1];
char line[513];
- pmlist_t *tmplist;
+ alpm_list_t *tmplist;
char *locale;
if(db == NULL) {
@@ -238,7 +238,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(info->filename);
} else if(!strcmp(line, "%DESC%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->desc_localized = _alpm_list_add(info->desc_localized, strdup(line));
+ info->desc_localized = alpm_list_add(info->desc_localized, strdup(line));
}
if((locale = setlocale(LC_ALL, "")) == NULL) { /* To fix segfault when locale invalid */
@@ -263,7 +263,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(info->desc);
} else if(!strcmp(line, "%GROUPS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->groups = _alpm_list_add(info->groups, strdup(line));
+ info->groups = alpm_list_add(info->groups, strdup(line));
}
} else if(!strcmp(line, "%URL%")) {
if(fgets(info->url, sizeof(info->url), fp) == NULL) {
@@ -272,7 +272,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(info->url);
} else if(!strcmp(line, "%LICENSE%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->license = _alpm_list_add(info->license, strdup(line));
+ info->license = alpm_list_add(info->license, strdup(line));
}
} else if(!strcmp(line, "%ARCH%")) {
if(fgets(info->arch, sizeof(info->arch), fp) == NULL) {
@@ -347,7 +347,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
/* the REPLACES tag is special -- it only appears in sync repositories,
* not the local one. */
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->replaces = _alpm_list_add(info->replaces, strdup(line));
+ info->replaces = alpm_list_add(info->replaces, strdup(line));
}
} else if(!strcmp(line, "%FORCE%")) {
/* FORCE tag only appears in sync repositories,
@@ -371,11 +371,11 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(line);
if(!strcmp(line, "%FILES%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->files = _alpm_list_add(info->files, strdup(line));
+ info->files = alpm_list_add(info->files, strdup(line));
}
} else if(!strcmp(line, "%BACKUP%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->backup = _alpm_list_add(info->backup, strdup(line));
+ info->backup = alpm_list_add(info->backup, strdup(line));
}
}
}
@@ -396,25 +396,25 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(line);
if(!strcmp(line, "%DEPENDS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->depends = _alpm_list_add(info->depends, strdup(line));
+ info->depends = alpm_list_add(info->depends, strdup(line));
}
} else if(!strcmp(line, "%REQUIREDBY%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->requiredby = _alpm_list_add(info->requiredby, strdup(line));
+ info->requiredby = alpm_list_add(info->requiredby, strdup(line));
}
} else if(!strcmp(line, "%CONFLICTS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->conflicts = _alpm_list_add(info->conflicts, strdup(line));
+ info->conflicts = alpm_list_add(info->conflicts, strdup(line));
}
} else if(!strcmp(line, "%PROVIDES%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->provides = _alpm_list_add(info->provides, strdup(line));
+ info->provides = alpm_list_add(info->provides, strdup(line));
}
} else if(!strcmp(line, "%REPLACES%")) {
/* the REPLACES tag is special -- it only appears in sync repositories,
* not the local one. */
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->replaces = _alpm_list_add(info->replaces, strdup(line));
+ info->replaces = alpm_list_add(info->replaces, strdup(line));
}
} else if(!strcmp(line, "%FORCE%")) {
/* FORCE tag only appears in sync repositories,
@@ -451,7 +451,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
FILE *fp = NULL;
char path[PATH_MAX];
mode_t oldmask;
- pmlist_t *lp = NULL;
+ alpm_list_t *lp = NULL;
int retval = 0;
int local = 0;
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 6aa517cf..db04b465 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -30,7 +30,7 @@
/* pacman */
#include "log.h"
#include "alpm.h"
-#include "list.h"
+#include "alpm_list.h"
#include "util.h"
#include "error.h"
#include "package.h"
@@ -62,11 +62,11 @@ int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel)
info->origin = PKG_FROM_CACHE;
info->data = db;
/* add to the collection */
- db->pkgcache = _alpm_list_add(db->pkgcache, info);
+ db->pkgcache = alpm_list_add(db->pkgcache, info);
count++;
}
- db->pkgcache = _alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
+ db->pkgcache = alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
return(0);
}
@@ -86,7 +86,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
}
}
-pmlist_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel)
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel)
{
if(db == NULL) {
return(NULL);
@@ -108,7 +108,7 @@ int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel)
* info is not already cached
*/
- pmlist_t *p;
+ alpm_list_t *p;
for(p = db->pkgcache; p; p = p->next) {
pmpkg_t *pkg = (pmpkg_t *)p->data;
if(infolevel != INFRQ_NONE && !(pkg->infolevel & infolevel)) {
@@ -136,7 +136,7 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
return(-1);
}
_alpm_log(PM_LOG_DEBUG, _("adding entry '%s' in '%s' cache"), newpkg->name, db->treename);
- db->pkgcache = _alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
+ db->pkgcache = alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
_alpm_db_free_grpcache(db);
@@ -152,7 +152,7 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
return(-1);
}
- db->pkgcache = _alpm_list_remove(db->pkgcache, pkg, _alpm_pkg_cmp, &vdata);
+ db->pkgcache = alpm_list_remove(db->pkgcache, pkg, _alpm_pkg_cmp, &vdata);
data = vdata;
if(data == NULL) {
/* package not found */
@@ -180,7 +180,7 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target)
*/
int _alpm_db_load_grpcache(pmdb_t *db)
{
- pmlist_t *lp;
+ alpm_list_t *lp;
if(db == NULL) {
return(-1);
@@ -193,25 +193,25 @@ int _alpm_db_load_grpcache(pmdb_t *db)
_alpm_log(PM_LOG_DEBUG, _("loading group cache for repository '%s'"), db->treename);
for(lp = _alpm_db_get_pkgcache(db, INFRQ_DESC); lp; lp = lp->next) {
- pmlist_t *i;
+ alpm_list_t *i;
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_is_strin(i->data, db->grpcache)) {
pmgrp_t *grp = _alpm_grp_new();
STRNCPY(grp->name, (char *)i->data, GRP_NAME_LEN);
- grp->packages = _alpm_list_add_sorted(grp->packages, pkg->name, _alpm_grp_cmp);
- db->grpcache = _alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp);
+ grp->packages = alpm_list_add_sorted(grp->packages, pkg->name, _alpm_grp_cmp);
+ db->grpcache = alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp);
} else {
- pmlist_t *j;
+ alpm_list_t *j;
for(j = db->grpcache; j; j = j->next) {
pmgrp_t *grp = j->data;
if(strcmp(grp->name, i->data) == 0) {
- if(!_alpm_list_is_strin(pkg->name, grp->packages)) {
- grp->packages = _alpm_list_add_sorted(grp->packages, (char *)pkg->name, _alpm_grp_cmp);
+ if(!alpm_list_is_strin(pkg->name, grp->packages)) {
+ grp->packages = alpm_list_add_sorted(grp->packages, (char *)pkg->name, _alpm_grp_cmp);
}
}
}
@@ -224,7 +224,7 @@ int _alpm_db_load_grpcache(pmdb_t *db)
void _alpm_db_free_grpcache(pmdb_t *db)
{
- pmlist_t *lg;
+ alpm_list_t *lg;
if(db == NULL || db->grpcache == NULL) {
return;
@@ -239,7 +239,7 @@ void _alpm_db_free_grpcache(pmdb_t *db)
FREELIST(db->grpcache);
}
-pmlist_t *_alpm_db_get_grpcache(pmdb_t *db)
+alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
{
if(db == NULL) {
return(NULL);
@@ -254,7 +254,7 @@ pmlist_t *_alpm_db_get_grpcache(pmdb_t *db)
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, char *target)
{
- pmlist_t *i;
+ alpm_list_t *i;
if(db == NULL || target == NULL || strlen(target) == 0) {
return(NULL);
diff --git a/lib/libalpm/cache.h b/lib/libalpm/cache.h
index 5b366bdf..c17b8268 100644
--- a/lib/libalpm/cache.h
+++ b/lib/libalpm/cache.h
@@ -22,7 +22,7 @@
#define _ALPM_CACHE_H
#include "db.h"
-#include "list.h"
+#include "alpm_list.h"
#include "group.h"
#include "package.h"
@@ -31,13 +31,13 @@ int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel);
void _alpm_db_free_pkgcache(pmdb_t *db);
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
-pmlist_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel);
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel);
int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel);
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target);
/* groups */
int _alpm_db_load_grpcache(pmdb_t *db);
void _alpm_db_free_grpcache(pmdb_t *db);
-pmlist_t *_alpm_db_get_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);
#endif /* _ALPM_CACHE_H */
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 570520f1..088320e6 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -37,7 +37,7 @@
#include <libintl.h>
/* pacman */
#include "handle.h"
-#include "list.h"
+#include "alpm_list.h"
#include "trans.h"
#include "util.h"
#include "error.h"
@@ -46,15 +46,15 @@
#include "deps.h"
#include "conflict.h"
-/* Returns a pmlist_t* of pmdepmissing_t pointers.
+/* Returns a alpm_list_t* of pmdepmissing_t pointers.
*
* conflicts are always name only
*/
-pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
+alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages)
{
pmpkg_t *info = NULL;
- pmlist_t *i, *j, *k;
- pmlist_t *baddeps = NULL;
+ alpm_list_t *i, *j, *k;
+ alpm_list_t *baddeps = NULL;
pmdepmissing_t *miss = NULL;
if(db == NULL) {
@@ -86,13 +86,13 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
dp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
} else {
/* see if dp provides something in tp's conflict list */
- pmlist_t *m;
+ alpm_list_t *m;
for(m = dp->provides; m; m = m->next) {
if(!strcmp(m->data, j->data)) {
/* confict */
@@ -100,7 +100,7 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
dp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -122,20 +122,20 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
otp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
} else {
/* see if otp provides something in tp's conflict list */
- pmlist_t *m;
+ alpm_list_t *m;
for(m = otp->provides; m; m = m->next) {
if(!strcmp(m->data, j->data)) {
_alpm_log(PM_LOG_DEBUG, _("targs vs targs: found %s as a conflict for %s"),
otp->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -147,7 +147,7 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
/* CHECK 3: check database against targets */
_alpm_log(PM_LOG_DEBUG, _("checkconflicts: db vs targ '%s'"), tp->name);
for(k = _alpm_db_get_pkgcache(db, INFRQ_DEPENDS); k; k = k->next) {
- pmlist_t *conflicts = NULL;
+ alpm_list_t *conflicts = NULL;
int usenewconflicts = 0;
info = k->data;
@@ -155,7 +155,7 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
/* a package cannot conflict with itself -- that's just not nice */
continue;
}
- /* If this package (*info) is also in our packages pmlist_t, use the
+ /* If this package (*info) is also in our packages alpm_list_t, use the
* conflicts list from the new package, not the old one (*info)
*/
for(j = packages; j; j = j->next) {
@@ -176,22 +176,22 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
info->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
} else {
/* see if the db package conflicts with something we provide */
- pmlist_t *m;
+ alpm_list_t *m;
for(m = conflicts; m; m = m->next) {
- pmlist_t *n;
+ alpm_list_t *n;
for(n = tp->provides; n; n = n->next) {
if(!strcmp(m->data, n->data)) {
_alpm_log(PM_LOG_DEBUG, _("db vs targs: found %s as a conflict for %s"),
info->name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -206,18 +206,18 @@ pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages)
return(baddeps);
}
-/* Returns a pmlist_t* of file conflicts.
+/* Returns a alpm_list_t* of file conflicts.
*
- * adds list of files to skip to pmlist_t** skip_list.
+ * adds list of files to skip to alpm_list_t** skip_list.
*/
-pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmlist_t **skip_list)
+alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, alpm_list_t **skip_list)
{
- pmlist_t *i, *j, *k;
+ alpm_list_t *i, *j, *k;
char *filestr = NULL;
char path[PATH_MAX+1];
struct stat buf, buf2;
- pmlist_t *conflicts = NULL;
- pmlist_t *targets = trans->packages;
+ alpm_list_t *conflicts = NULL;
+ alpm_list_t *targets = trans->packages;
double percent;
if(db == NULL || targets == NULL || root == NULL) {
@@ -226,8 +226,8 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
/* CHECK 1: check every target against every target */
for(i = targets; i; i = i->next) {
pmpkg_t *p1 = (pmpkg_t*)i->data;
- percent = (double)(_alpm_list_count(targets) - _alpm_list_count(i) + 1) / _alpm_list_count(targets);
- PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100), _alpm_list_count(targets), (_alpm_list_count(targets) - _alpm_list_count(i) +1));
+ percent = (double)(alpm_list_count(targets) - alpm_list_count(i) + 1) / alpm_list_count(targets);
+ PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100), alpm_list_count(targets), (alpm_list_count(targets) - alpm_list_count(i) +1));
for(j = i; j; j = j->next) {
pmpkg_t *p2 = (pmpkg_t*)j->data;
if(strcmp(p1->name, p2->name)) {
@@ -240,7 +240,7 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
if(strcmp(filestr, ".INSTALL") == 0) {
continue;
}
- if(_alpm_list_is_strin(filestr, p2->files)) {
+ if(alpm_list_is_strin(filestr, p2->files)) {
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
if(conflict == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
@@ -251,7 +251,7 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
STRNCPY(conflict->target, p1->name, PKG_NAME_LEN);
STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN);
STRNCPY(conflict->ctarget, p2->name, PKG_NAME_LEN);
- conflicts = _alpm_list_add(conflicts, conflict);
+ conflicts = alpm_list_add(conflicts, conflict);
}
}
}
@@ -284,7 +284,7 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
_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_is_strin(j->data, dbpkg->files)) {
ok = 1;
}
/* Make sure that the supposedly-conflicting file is not actually just
@@ -315,7 +315,7 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
_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_is_strin(filestr, p1->files) && alpm_list_is_strin(filestr, dbpkg2->files)) {
ok = 1;
/* Add to the "skip list" of files that we shouldn't remove during an upgrade.
*
@@ -333,7 +333,7 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
* Our workaround is to scan through all "old" packages and all "new"
* ones, looking for files that jump to different packages.
*/
- *skip_list = _alpm_list_add(*skip_list, strdup(filestr));
+ *skip_list = alpm_list_add(*skip_list, strdup(filestr));
}
}
}
@@ -350,7 +350,7 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
STRNCPY(conflict->target, p->name, PKG_NAME_LEN);
STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN);
conflict->ctarget[0] = 0;
- conflicts = _alpm_list_add(conflicts, conflict);
+ conflicts = alpm_list_add(conflicts, conflict);
}
}
}
diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h
index 7bf8744b..07225991 100644
--- a/lib/libalpm/conflict.h
+++ b/lib/libalpm/conflict.h
@@ -33,8 +33,8 @@ struct __pmconflict_t {
char ctarget[PKG_NAME_LEN];
};
-pmlist_t *_alpm_checkconflicts(pmdb_t *db, pmlist_t *packages);
-pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmlist_t **skip_list);
+alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages);
+alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, alpm_list_t **skip_list);
#endif /* _ALPM_CONFLICT_H */
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 1cc603be..84c05ccc 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -96,9 +96,9 @@ int _alpm_db_cmp(const void *db1, const void *db2)
return(strcmp(((pmdb_t *)db1)->treename, ((pmdb_t *)db2)->treename));
}
-pmlist_t *_alpm_db_search(pmdb_t *db, pmlist_t *needles)
+alpm_list_t *_alpm_db_search(pmdb_t *db, alpm_list_t *needles)
{
- pmlist_t *i, *j, *k, *ret = NULL;
+ alpm_list_t *i, *j, *k, *ret = NULL;
for(i = needles; i; i = i->next) {
char *targ;
@@ -139,7 +139,7 @@ pmlist_t *_alpm_db_search(pmdb_t *db, pmlist_t *needles)
if(matched != NULL) {
_alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'", targ, matched);
- ret = _alpm_list_add(ret, pkg);
+ ret = alpm_list_add(ret, pkg);
}
}
}
@@ -159,7 +159,7 @@ pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback)
RET_ERR(PM_ERR_DB_NOT_NULL, NULL);
}
} else {
- pmlist_t *i;
+ alpm_list_t *i;
for(i = handle->dbs_sync; i; i = i->next) {
pmdb_t *sdb = i->data;
if(strcmp(treename, sdb->treename) == 0) {
@@ -197,7 +197,7 @@ pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback)
if(strcmp(treename, "local") == 0) {
handle->db_local = db;
} else {
- handle->dbs_sync = _alpm_list_add(handle->dbs_sync, db);
+ handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
}
return(db);
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 9224d69a..6d9ddd2c 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -39,15 +39,15 @@ struct __pmdb_t {
char *path;
char treename[PATH_MAX];
void *handle;
- pmlist_t *pkgcache;
- pmlist_t *grpcache;
- pmlist_t *servers;
+ alpm_list_t *pkgcache;
+ alpm_list_t *grpcache;
+ alpm_list_t *servers;
};
/* db.c, database general calls */
pmdb_t *_alpm_db_new(char *root, char *dbpath, char *treename);
void _alpm_db_free(void *data);
int _alpm_db_cmp(const void *db1, const void *db2);
-pmlist_t *_alpm_db_search(pmdb_t *db, pmlist_t *needles);
+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);
/* be.c, backend specific calls */
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index cb53d41b..31aba2b4 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -33,7 +33,7 @@
#include "util.h"
#include "log.h"
#include "error.h"
-#include "list.h"
+#include "alpm_list.h"
#include "package.h"
#include "db.h"
#include "cache.h"
@@ -68,9 +68,9 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsign
return(miss);
}
-int _alpm_depmiss_isin(pmdepmissing_t *needle, pmlist_t *haystack)
+int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack)
{
- pmlist_t *i;
+ alpm_list_t *i;
for(i = haystack; i; i = i->next) {
pmdepmissing_t *miss = i->data;
@@ -95,13 +95,13 @@ int _alpm_depmiss_isin(pmdepmissing_t *needle, pmlist_t *haystack)
* mode should be either PM_TRANS_TYPE_ADD or PM_TRANS_TYPE_REMOVE. This
* affects the dependency order sortbydeps() will use.
*
- * This function returns the new pmlist_t* target list.
+ * This function returns the new alpm_list_t* target list.
*
*/
-pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
+alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode)
{
- pmlist_t *newtargs = NULL;
- pmlist_t *i, *j, *k, *l;
+ alpm_list_t *newtargs = NULL;
+ alpm_list_t *i, *j, *k, *l;
int change = 1;
int numscans = 0;
int numtargs = 0;
@@ -111,13 +111,13 @@ pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
}
for(i = targets; i; i = i->next) {
- newtargs = _alpm_list_add(newtargs, i->data);
+ newtargs = alpm_list_add(newtargs, i->data);
numtargs++;
}
_alpm_log(PM_LOG_DEBUG, _("started sorting dependencies"));
while(change) {
- pmlist_t *tmptargs = NULL;
+ alpm_list_t *tmptargs = NULL;
change = 0;
/* TODO only use of a math.h function in entire libalpm,
* can we get rid of it? Former code line:
@@ -147,7 +147,7 @@ pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
if(!strcmp(dep.name, q->name)) {
if(!_alpm_pkg_isin(q->name, tmptargs)) {
change = 1;
- tmptargs = _alpm_list_add(tmptargs, q);
+ tmptargs = alpm_list_add(tmptargs, q);
}
break;
}
@@ -155,7 +155,7 @@ pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
if(!strcmp(dep.name, (char*)l->data)) {
if(!_alpm_pkg_isin((char*)l->data, tmptargs)) {
change = 1;
- tmptargs = _alpm_list_add(tmptargs, q);
+ tmptargs = alpm_list_add(tmptargs, q);
}
break;
}
@@ -163,7 +163,7 @@ pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
}
}
if(!_alpm_pkg_isin(p->name, tmptargs)) {
- tmptargs = _alpm_list_add(tmptargs, p);
+ tmptargs = alpm_list_add(tmptargs, p);
}
}
FREELISTPTR(newtargs);
@@ -173,7 +173,7 @@ pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
if(mode == PM_TRANS_TYPE_REMOVE) {
/* we're removing packages, so reverse the order */
- pmlist_t *tmptargs = _alpm_list_reverse(newtargs);
+ alpm_list_t *tmptargs = alpm_list_reverse(newtargs);
/* free the old one */
FREELISTPTR(newtargs);
newtargs = tmptargs;
@@ -182,17 +182,17 @@ pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode)
return(newtargs);
}
-/* Returns a pmlist_t* of missing_t pointers.
+/* Returns a alpm_list_t* of missing_t pointers.
*
* dependencies can include versions with depmod operators.
*
*/
-pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist_t *packages)
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, alpm_list_t *packages)
{
pmdepend_t depend;
- pmlist_t *i, *j, *k;
+ alpm_list_t *i, *j, *k;
int found = 0;
- pmlist_t *baddeps = NULL;
+ alpm_list_t *baddeps = NULL;
pmdepmissing_t *miss = NULL;
if(db == NULL) {
@@ -237,7 +237,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
}
if(found == 0) {
/* look for packages that list depend.name as a "provide" */
- pmlist_t *provides = _alpm_db_whatprovides(db, depend.name);
+ alpm_list_t *provides = _alpm_db_whatprovides(db, depend.name);
if(provides == NULL) {
/* not found */
continue;
@@ -249,7 +249,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), depend.name, p->name);
miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -284,7 +284,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
}
/* check database for provides matches */
if(!found) {
- pmlist_t *m;
+ alpm_list_t *m;
k = _alpm_db_whatprovides(db, depend.name);
for(m = k; m && !found; m = m->next) {
/* look for a match that isn't one of the packages we're trying
@@ -292,7 +292,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
* package, we'll defer to the NEW one, not the one already
* installed. */
pmpkg_t *p = m->data;
- pmlist_t *n;
+ alpm_list_t *n;
int skip = 0;
for(n = packages; n && !skip; n = n->next) {
pmpkg_t *ptp = n->data;
@@ -319,7 +319,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
depend.name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -338,7 +338,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
for(j = tp->requiredby; j; j = j->next) {
/* Search for 'reqname' in packages for removal */
char *reqname = j->data;
- pmlist_t *x = NULL;
+ alpm_list_t *x = NULL;
for(x = packages; x; x = x->next) {
pmpkg_t *xp = x->data;
if(strcmp(reqname, xp->name) == 0) {
@@ -357,7 +357,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
spkg = k->data;
}
if(spkg) {
- if(_alpm_list_is_strin(tp->name, spkg->provides)) {
+ if(alpm_list_is_strin(tp->name, spkg->provides)) {
found = 1;
}
}
@@ -366,7 +366,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), reqname, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = _alpm_list_add(baddeps, miss);
+ baddeps = alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -422,15 +422,15 @@ int _alpm_splitdep(char *depstr, pmdepend_t *depend)
return(0);
}
-/* return a new pmlist_t target list containing all packages in the original
+/* return a new alpm_list_t target list containing all packages in the original
* target list, as well as all their un-needed dependencies. By un-needed,
* I mean dependencies that are *only* required for packages in the target
* list, so they can be safely removed. This function is recursive.
*/
-pmlist_t *_alpm_removedeps(pmdb_t *db, pmlist_t *targs)
+alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs)
{
- pmlist_t *i, *j, *k;
- pmlist_t *newtargs = targs;
+ alpm_list_t *i, *j, *k;
+ alpm_list_t *newtargs = targs;
if(db == NULL) {
return(newtargs);
@@ -497,7 +497,7 @@ pmlist_t *_alpm_removedeps(pmdb_t *db, pmlist_t *targs)
/* add it to the target list */
_alpm_log(PM_LOG_DEBUG, _("loading ALL info for '%s'"), pkg->name);
_alpm_db_read(db, INFRQ_ALL, pkg);
- newtargs = _alpm_list_add(newtargs, pkg);
+ newtargs = alpm_list_add(newtargs, pkg);
_alpm_log(PM_LOG_FLOW2, _("adding '%s' to the targets"), pkg->name);
newtargs = _alpm_removedeps(db, newtargs);
}
@@ -512,19 +512,19 @@ pmlist_t *_alpm_removedeps(pmdb_t *db, pmlist_t *targs)
*
* make sure *list and *trail are already initialized
*/
-int _alpm_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlist_t *list,
- pmlist_t *trail, pmtrans_t *trans, pmlist_t **data)
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, alpm_list_t *list,
+ alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data)
{
- pmlist_t *i, *j;
- pmlist_t *targ;
- pmlist_t *deps = NULL;
+ alpm_list_t *i, *j;
+ alpm_list_t *targ;
+ alpm_list_t *deps = NULL;
if(local == NULL || dbs_sync == NULL || syncpkg == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, _("started resolving dependencies"));
- targ = _alpm_list_add(NULL, syncpkg);
+ targ = alpm_list_add(NULL, syncpkg);
deps = _alpm_checkdeps(trans, local, PM_TRANS_TYPE_ADD, targ);
FREELISTPTR(targ);
@@ -540,7 +540,7 @@ int _alpm_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlis
/* 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_is_strin(miss->depend.name, sp->provides)) {
_alpm_log(PM_LOG_DEBUG, _("%s provides dependency %s -- skipping"),
sp->name, miss->depend.name);
found = 1;
@@ -558,7 +558,7 @@ int _alpm_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlis
}
/* check provides */
for(j = dbs_sync; !sync && j; j = j->next) {
- pmlist_t *provides;
+ alpm_list_t *provides;
provides = _alpm_db_whatprovides(j->data, miss->depend.name);
if(provides) {
sync = provides->data;
@@ -576,7 +576,7 @@ int _alpm_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlis
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = _alpm_list_add(*data, miss);
+ *data = alpm_list_add(*data, miss);
}
pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
@@ -593,19 +593,19 @@ int _alpm_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlis
* something we're not supposed to.
*/
int usedep = 1;
- if(_alpm_list_is_strin(sync->name, handle->ignorepkg)) {
+ if(alpm_list_is_strin(sync->name, handle->ignorepkg)) {
pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep);
FREEPKG(dummypkg);
}
if(usedep) {
- trail = _alpm_list_add(trail, sync);
+ trail = alpm_list_add(trail, sync);
if(_alpm_resolvedeps(local, dbs_sync, sync, list, trail, trans, data)) {
goto error;
}
_alpm_log(PM_LOG_DEBUG, _("pulling dependency %s (needed by %s)"),
sync->name, syncpkg->name);
- list = _alpm_list_add(list, sync);
+ list = alpm_list_add(list, sync);
} else {
_alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\""), miss->target);
if(data) {
@@ -616,7 +616,7 @@ int _alpm_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlis
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = _alpm_list_add(*data, miss);
+ *data = alpm_list_add(*data, miss);
}
pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index 72425f56..d34d1eca 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -44,13 +44,13 @@ struct __pmdepmissing_t {
pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsigned char depmod,
const char *depname, const char *depversion);
-int _alpm_depmiss_isin(pmdepmissing_t *needle, pmlist_t *haystack);
-pmlist_t *_alpm_sortbydeps(pmlist_t *targets, int mode);
-pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist_t *packages);
+int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack);
+alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode);
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, alpm_list_t *packages);
int _alpm_splitdep(char *depstr, pmdepend_t *depend);
-pmlist_t *_alpm_removedeps(pmdb_t *db, pmlist_t *targs);
-int _alpm_resolvedeps(pmdb_t *local, pmlist_t *dbs_sync, pmpkg_t *syncpkg, pmlist_t *list,
- pmlist_t *trail, pmtrans_t *trans, pmlist_t **data);
+alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs);
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, alpm_list_t *list,
+ alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data);
#endif /* _ALPM_DEPS_H */
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index ecc608d8..e0294ccb 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -29,7 +29,7 @@
#include "error.h"
#include "log.h"
#include "group.h"
-#include "list.h"
+#include "alpm_list.h"
#include "alpm.h"
pmgrp_t *_alpm_grp_new()
@@ -81,7 +81,7 @@ const char *alpm_grp_get_name(pmgrp_t *grp)
return grp->name;
}
-pmlist_t *alpm_grp_get_packages(pmgrp_t *grp)
+alpm_list_t *alpm_grp_get_packages(pmgrp_t *grp)
{
/* Sanity checks */
ASSERT(grp != NULL, return(NULL));
diff --git a/lib/libalpm/group.h b/lib/libalpm/group.h
index 86562b10..c5366e64 100644
--- a/lib/libalpm/group.h
+++ b/lib/libalpm/group.h
@@ -28,7 +28,7 @@
struct __pmgrp_t {
char name[GRP_NAME_LEN];
- pmlist_t *packages; /* List of strings */
+ alpm_list_t *packages; /* List of strings */
};
#define FREEGRP(p) do { if(p) { _alpm_grp_free(p); p = NULL; } } while(0)
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index c6338d59..42490f6e 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -33,7 +33,7 @@
/* pacman */
#include "util.h"
#include "log.h"
-#include "list.h"
+#include "alpm_list.h"
#include "error.h"
#include "trans.h"
#include "alpm.h"
@@ -123,19 +123,19 @@ const char *alpm_option_get_dbpath() { return handle->dbpath; }
const char *alpm_option_get_cachedir() { return handle->cachedir; }
const char *alpm_option_get_logfile() { return handle->logfile; }
unsigned char alpm_option_get_usesyslog() { return handle->usesyslog; }
-pmlist_t *alpm_option_get_noupgrades() { return handle->noupgrade; }
-pmlist_t *alpm_option_get_noextracts() { return handle->noextract; }
-pmlist_t *alpm_option_get_ignorepkgs() { return handle->ignorepkg; }
-pmlist_t *alpm_option_get_holdpkgs() { return handle->holdpkg; }
+alpm_list_t *alpm_option_get_noupgrades() { return handle->noupgrade; }
+alpm_list_t *alpm_option_get_noextracts() { return handle->noextract; }
+alpm_list_t *alpm_option_get_ignorepkgs() { return handle->ignorepkg; }
+alpm_list_t *alpm_option_get_holdpkgs() { return handle->holdpkg; }
time_t alpm_option_get_upgradedelay() { return handle->upgradedelay; }
const char *alpm_option_get_xfercommand() { return handle->xfercommand; }
unsigned short alpm_option_get_nopassiveftp() { return handle->nopassiveftp; }
unsigned short alpm_option_get_chomp() { return handle->chomp; }
-pmlist_t *alpm_option_get_needles() { return handle->needles; }
+alpm_list_t *alpm_option_get_needles() { return handle->needles; }
unsigned short alpm_option_get_usecolor() { return handle->use_color; }
-pmdb_t *alpm_option_get_localdb(pmhandle_t *handle) { return handle->db_local; }
-pmlist_t *alpm_option_get_syncdbs(pmhandle_t *handle) { return handle->dbs_sync; }
+pmdb_t *alpm_option_get_localdb() { return handle->db_local; }
+alpm_list_t *alpm_option_get_syncdbs() { return handle->dbs_sync; }
void alpm_option_set_logcb(alpm_cb_log cb) { handle->logcb = cb; }
@@ -180,9 +180,9 @@ void alpm_option_set_usesyslog(unsigned char usesyslog) { handle->usesyslog = us
void alpm_option_add_noupgrade(char *pkg)
{
- handle->noupgrade = _alpm_list_add(handle->noupgrade, strdup(pkg));
+ handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
}
-void alpm_option_set_noupgrades(pmlist_t *noupgrade)
+void alpm_option_set_noupgrades(alpm_list_t *noupgrade)
{
if(handle->noupgrade) FREELIST(handle->noupgrade);
if(noupgrade) handle->noupgrade = noupgrade;
@@ -190,9 +190,9 @@ void alpm_option_set_noupgrades(pmlist_t *noupgrade)
void alpm_option_add_noextract(char *pkg)
{
- handle->noextract = _alpm_list_add(handle->noextract, strdup(pkg));
+ handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
}
-void alpm_option_set_noextracts(pmlist_t *noextract)
+void alpm_option_set_noextracts(alpm_list_t *noextract)
{
if(handle->noextract) FREELIST(handle->noextract);
if(noextract) handle->noextract = noextract;
@@ -200,9 +200,9 @@ void alpm_option_set_noextracts(pmlist_t *noextract)
void alpm_option_add_ignorepkg(char *pkg)
{
- handle->ignorepkg = _alpm_list_add(handle->ignorepkg, strdup(pkg));
+ handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
}
-void alpm_option_set_ignorepkgs(pmlist_t *ignorepkgs)
+void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
{
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
if(ignorepkgs) handle->ignorepkg = ignorepkgs;
@@ -210,9 +210,9 @@ void alpm_option_set_ignorepkgs(pmlist_t *ignorepkgs)
void alpm_option_add_holdpkg(char *pkg)
{
- handle->holdpkg = _alpm_list_add(handle->holdpkg, strdup(pkg));
+ handle->holdpkg = alpm_list_add(handle->holdpkg, strdup(pkg));
}
-void alpm_option_set_holdpkgs(pmlist_t *holdpkgs)
+void alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
{
if(handle->holdpkg) FREELIST(handle->holdpkg);
if(holdpkgs) handle->holdpkg = holdpkgs;
@@ -232,9 +232,9 @@ void alpm_option_set_chomp(unsigned short chomp) { handle->chomp = chomp; }
void alpm_option_add_needle(char *needle)
{
- handle->needles = _alpm_list_add(handle->needles, strdup(needle));
+ handle->needles = alpm_list_add(handle->needles, strdup(needle));
}
-void alpm_option_set_needles(pmlist_t *needles)
+void alpm_option_set_needles(alpm_list_t *needles)
{
if(handle->needles) FREELIST(handle->needles);
if(needles) handle->needles = needles;
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index 41e8a5fe..eb5f734e 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -23,7 +23,7 @@
#include "db.h"
#include "log.h"
-#include "list.h"
+#include "alpm_list.h"
#include "alpm.h"
#include "trans.h"
@@ -37,7 +37,7 @@ typedef struct _pmhandle_t {
pmaccess_t access;
uid_t uid;
pmdb_t *db_local;
- pmlist_t *dbs_sync; /* List of (pmdb_t *) */
+ alpm_list_t *dbs_sync; /* List of (pmdb_t *) */
FILE *logfd;
int lckfd;
pmtrans_t *trans;
@@ -52,17 +52,17 @@ typedef struct _pmhandle_t {
char *logfile; /* Name of the file to log to */ /*TODO is this used?*/
unsigned char usesyslog; /* Use syslog instead of logfile? */
- pmlist_t *noupgrade; /* List of packages NOT to be upgraded */
- pmlist_t *noextract; /* List of packages NOT to extrace */ /*TODO is this used?*/
- pmlist_t *ignorepkg; /* List of packages to ignore */
- pmlist_t *holdpkg; /* List of packages which 'hold' pacman */
+ alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */
+ alpm_list_t *noextract; /* List of packages NOT to extrace */ /*TODO is this used?*/
+ alpm_list_t *ignorepkg; /* List of packages to ignore */
+ alpm_list_t *holdpkg; /* List of packages which 'hold' pacman */
time_t upgradedelay; /* Amount of time to wait before upgrading a package*/
/* servers */
char *xfercommand; /* External download command */
unsigned short nopassiveftp; /* Don't use PASV ftp connections */
unsigned short chomp; /* I Love Candy! */
- pmlist_t *needles; /* needles for searching */ /* TODO why is this here? */
+ alpm_list_t *needles; /* needles for searching */ /* TODO why is this here? */
unsigned short use_color; /* enable colorful output */
} pmhandle_t;
diff --git a/lib/libalpm/list.c b/lib/libalpm/list.c
deleted file mode 100644
index b6797073..00000000
--- a/lib/libalpm/list.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * list.c
- *
- * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include "config.h"
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-/* pacman */
-#include "list.h"
-#include "util.h"
-
-pmlist_t *_alpm_list_new()
-{
- pmlist_t *list = NULL;
-
- list = (pmlist_t *)malloc(sizeof(pmlist_t));
- if(list == NULL) {
- return(NULL);
- }
- list->data = NULL;
- list->prev = NULL;
- list->next = NULL;
- list->last = list;
- return(list);
-}
-
-void _alpm_list_free(pmlist_t *list, _alpm_fn_free fn)
-{
- pmlist_t *ptr, *it = list;
-
- while(it) {
- ptr = it->next;
- if(fn && it->data) {
- fn(it->data);
- }
- FREE(it);
- it = ptr;
- }
-}
-
-pmlist_t *_alpm_list_add(pmlist_t *list, void *data)
-{
- pmlist_t *ptr, *lp;
-
- ptr = list;
- if(ptr == NULL) {
- ptr = _alpm_list_new();
- if(ptr == NULL) {
- return(NULL);
- }
- }
-
- lp = _alpm_list_last(ptr);
- if(lp == ptr && lp->data == NULL) {
- /* nada */
- } else {
- lp->next = _alpm_list_new();
- if(lp->next == NULL) {
- return(NULL);
- }
- lp->next->prev = lp;
- lp->last = NULL;
- lp = lp->next;
- }
-
- lp->data = data;
- ptr->last = lp;
-
- return(ptr);
-}
-
-/* Add items to a list in sorted order. Use the given comparision func to
- * determine order.
- */
-pmlist_t *_alpm_list_add_sorted(pmlist_t *list, void *data, _alpm_fn_cmp fn)
-{
- pmlist_t *add;
- pmlist_t *prev = NULL;
- pmlist_t *iter = list;
-
- add = _alpm_list_new();
- add->data = data;
-
- /* Find insertion point. */
- while(iter) {
- if(fn(add->data, iter->data) <= 0) break;
- prev = iter;
- iter = iter->next;
- }
-
- /* Insert node before insertion point. */
- add->prev = prev;
- add->next = iter;
-
- if(iter != NULL) {
- iter->prev = add; /* Not at end. */
- } else {
- if (list != NULL) {
- list->last = add; /* Added new to end, so update the link to last. */
- }
- }
-
- if(prev != NULL) {
- prev->next = add; /* In middle. */
- } else {
- if(list == NULL) {
- add->last = add;
- } else {
- add->last = list->last;
- list->last = NULL;
- }
- list = add; /* Start or empty, new list head. */
- }
-
- return(list);
-}
-
-/* return nth element from list (starting with 0) */
-pmlist_t* _alpm_list_nth(pmlist_t *list, int n) {
- while (n--)
- list = list->next;
- return list;
-}
-
-/* merge the two sorted sublists into one sorted list */
-pmlist_t* _alpm_list_mmerge(pmlist_t *left, pmlist_t *right, _alpm_fn_cmp fn) {
- pmlist_t *newlist;
- pmlist_t *lp;
-
- if (left == NULL)
- return right;
- if (right == NULL)
- return left;
-
- if (fn(left->data, right->data) <= 0) {
- newlist = left;
- left = left->next;
- }
- else {
- newlist = right;
- right = right->next;
- }
- newlist->prev = NULL;
- newlist->next = NULL;
- newlist->last = NULL;
- lp = newlist;
-
- while ((left != NULL) && (right != NULL)) {
- if (fn(left->data, right->data) <= 0) {
- lp->next = left;
- left->prev = lp;
- left = left->next;
- }
- else {
- lp->next = right;
- right->prev = lp;
- right = right->next;
- }
- lp = lp->next;
- lp->next = NULL;
- newlist->last = lp;
- }
- if (left != NULL) {
- lp->next = left;
- left->prev = lp;
- newlist->last = left->last;
- }
- else if (right != NULL) {
- lp->next = right;
- right->prev = lp;
- newlist->last = right->last;
- }
- return newlist;
-}
-
-/* sort an list of size n using mergesort algorithm */
-pmlist_t* _alpm_list_msort(pmlist_t *list, int len, _alpm_fn_cmp fn) {
- if (len > 1 ) {
- pmlist_t *left = list;
- pmlist_t *lastleft = _alpm_list_nth(list, len/2 - 1);
- pmlist_t *right = lastleft->next;
- /* update rights last element, to previous last element*/
- right->last = left->last;
- /* update lefts last element */
- left->last = lastleft;
- /* terminate first list */
- lastleft->next = NULL;
-
- left = _alpm_list_msort(left, len/2, fn);
- right = _alpm_list_msort(right, len - (len/2), fn);
- list = _alpm_list_mmerge(left, right, fn);
- }
- return list;
-}
-
-/* Remove an item in a list. Use the given comparaison function to find the
- * item.
- * If the item is found, 'data' is pointing to the removed element.
- * Otherwise, it is set to NULL.
- * Return the new list (without the removed element).
- */
-pmlist_t *_alpm_list_remove(pmlist_t *haystack, void *needle, _alpm_fn_cmp fn, void **data)
-{
- pmlist_t *i = haystack;
-
- if(data) {
- *data = NULL;
- }
-
- while(i) {
- if(i->data == NULL) {
- continue;
- }
- if(fn(needle, i->data) == 0) {
- break;
- }
- i = i->next;
- }
-
- if(i) {
- /* we found a matching item */
- if(i->next) {
- i->next->prev = i->prev;
- }
- if(i->prev) {
- i->prev->next = i->next;
- }
- if(i == haystack) {
- /* The item found is the first in the chain */
- if(haystack->next) {
- haystack->next->last = haystack->last;
- }
- haystack = haystack->next;
- } else if(i == haystack->last) {
- /* The item found is the last in the chain */
- haystack->last = i->prev;
- }
-
- if(data) {
- *data = i->data;
- }
- i->data = NULL;
- FREE(i);
- }
-
- return(haystack);
-}
-
-int _alpm_list_count(const pmlist_t *list)
-{
- int i;
- const pmlist_t *lp;
-
- for(lp = list, i = 0; lp; lp = lp->next, i++);
-
- return(i);
-}
-
-int _alpm_list_is_in(void *needle, pmlist_t *haystack)
-{
- pmlist_t *lp;
-
- for(lp = haystack; lp; lp = lp->next) {
- if(lp->data == needle) {
- return(1);
- }
- }
- return(0);
-}
-
-/* Test for existence of a string in a pmlist_t
-*/
-int _alpm_list_is_strin(char *needle, pmlist_t *haystack)
-{
- pmlist_t *lp;
-
- for(lp = haystack; lp; lp = lp->next) {
- if(lp->data && !strcmp(lp->data, needle)) {
- return(1);
- }
- }
- return(0);
-}
-
-pmlist_t *_alpm_list_last(pmlist_t *list)
-{
- if(list == NULL) {
- return(NULL);
- }
-
- return(list->last);
-}
-
-/* Filter out any duplicate strings in a list.
- *
- * Not the most efficient way, but simple to implement -- we assemble
- * a new list, using is_in() to check for dupes at each iteration.
- *
- */
-pmlist_t *_alpm_list_remove_dupes(pmlist_t *list)
-{
- pmlist_t *i, *newlist = NULL;
-
- for(i = list; i; i = i->next) {
- if(!_alpm_list_is_strin(i->data, newlist)) {
- newlist = _alpm_list_add(newlist, strdup(i->data));
- }
- }
- return newlist;
-}
-
-/* Reverse the order of a list
- *
- * The caller is responsible for freeing the old list
- */
-pmlist_t *_alpm_list_reverse(pmlist_t *list)
-{
- /* simple but functional -- we just build a new list, starting
- * with the old list's tail
- */
- pmlist_t *newlist = NULL;
- pmlist_t *lp;
-
- for(lp = list->last; lp; lp = lp->prev) {
- newlist = _alpm_list_add(newlist, lp->data);
- }
-
- return(newlist);
-}
-
-pmlist_t *_alpm_list_strdup(pmlist_t *list)
-{
- pmlist_t *newlist = NULL;
- pmlist_t *lp;
-
- for(lp = list; lp; lp = lp->next) {
- newlist = _alpm_list_add(newlist, strdup(lp->data));
- }
-
- return(newlist);
-}
-
-/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/list.h b/lib/libalpm/list.h
deleted file mode 100644
index a065b01e..00000000
--- a/lib/libalpm/list.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * list.h
- *
- * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-#ifndef _ALPM_LIST_H
-#define _ALPM_LIST_H
-
-#include "alpm.h"
-
-/* Chained list struct */
-struct __pmlist_t {
- void *data;
- struct __pmlist_t *prev;
- struct __pmlist_t *next;
- struct __pmlist_t *last; /* Quick access to last item in list */
-};
-
-#define _FREELIST(p, f) do { if(p) { _alpm_list_free(p, f); p = NULL; } } while(0)
-#define FREELIST(p) _FREELIST(p, free)
-#define FREELISTPTR(p) _FREELIST(p, NULL)
-
-typedef void (*_alpm_fn_free)(void *);
-/* Sort comparison callback function declaration */
-typedef int (*_alpm_fn_cmp)(const void *, const void *);
-
-pmlist_t *_alpm_list_new(void);
-void _alpm_list_free(pmlist_t *list, _alpm_fn_free fn);
-pmlist_t *_alpm_list_add(pmlist_t *list, void *data);
-pmlist_t *_alpm_list_add_sorted(pmlist_t *list, void *data, _alpm_fn_cmp fn);
-pmlist_t* _alpm_list_mmerge(pmlist_t *left, pmlist_t *right, _alpm_fn_cmp fn);
-pmlist_t* _alpm_list_msort(pmlist_t *list, int len, _alpm_fn_cmp fn);
-pmlist_t* _alpm_list_nth(pmlist_t *list, int n);
-pmlist_t *_alpm_list_remove(pmlist_t *haystack, void *needle, _alpm_fn_cmp fn, void **data);
-int _alpm_list_count(const pmlist_t *list);
-int _alpm_list_is_in(void *needle, pmlist_t *haystack);
-int _alpm_list_is_strin(char *needle, pmlist_t *haystack);
-pmlist_t *_alpm_list_last(pmlist_t *list);
-pmlist_t *_alpm_list_remove_dupes(pmlist_t *list);
-pmlist_t *_alpm_list_reverse(pmlist_t *list);
-pmlist_t *_alpm_list_strdup(pmlist_t *list);
-
-#endif /* _ALPM_LIST_H */
-
-/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index aa72be40..23d11bfd 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -33,7 +33,7 @@
#include "log.h"
#include "util.h"
#include "error.h"
-#include "list.h"
+#include "alpm_list.h"
#include "package.h"
#include "db.h"
#include "handle.h"
@@ -118,17 +118,17 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
newpkg->force = pkg->force;
newpkg->scriptlet = pkg->scriptlet;
newpkg->reason = pkg->reason;
- newpkg->license = _alpm_list_strdup(pkg->license);
- newpkg->desc_localized = _alpm_list_strdup(pkg->desc_localized);
- newpkg->requiredby = _alpm_list_strdup(pkg->requiredby);
- newpkg->conflicts = _alpm_list_strdup(pkg->conflicts);
- newpkg->files = _alpm_list_strdup(pkg->files);
- newpkg->backup = _alpm_list_strdup(pkg->backup);
- newpkg->depends = _alpm_list_strdup(pkg->depends);
- newpkg->removes = _alpm_list_strdup(pkg->removes);
- newpkg->groups = _alpm_list_strdup(pkg->groups);
- newpkg->provides = _alpm_list_strdup(pkg->provides);
- newpkg->replaces = _alpm_list_strdup(pkg->replaces);
+ newpkg->license = alpm_list_strdup(pkg->license);
+ newpkg->desc_localized = alpm_list_strdup(pkg->desc_localized);
+ newpkg->requiredby = alpm_list_strdup(pkg->requiredby);
+ newpkg->conflicts = alpm_list_strdup(pkg->conflicts);
+ newpkg->files = alpm_list_strdup(pkg->files);
+ newpkg->backup = alpm_list_strdup(pkg->backup);
+ newpkg->depends = alpm_list_strdup(pkg->depends);
+ newpkg->removes = alpm_list_strdup(pkg->removes);
+ newpkg->groups = alpm_list_strdup(pkg->groups);
+ newpkg->provides = alpm_list_strdup(pkg->provides);
+ newpkg->replaces = alpm_list_strdup(pkg->replaces);
/* internal */
newpkg->origin = pkg->origin;
newpkg->data = (newpkg->origin == PKG_FROM_FILE) ? strdup(pkg->data) : pkg->data;
@@ -214,7 +214,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
STRNCPY(info->version, ptr, sizeof(info->version));
} else if(!strcmp(key, "PKGDESC")) {
char *lang_tmp;
- info->desc_localized = _alpm_list_add(info->desc_localized, strdup(ptr));
+ info->desc_localized = alpm_list_add(info->desc_localized, strdup(ptr));
if((lang_tmp = (char *)malloc(strlen(setlocale(LC_ALL, "")))) == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
@@ -226,11 +226,11 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
}
FREE(lang_tmp);
} else if(!strcmp(key, "GROUP")) {
- info->groups = _alpm_list_add(info->groups, strdup(ptr));
+ info->groups = alpm_list_add(info->groups, strdup(ptr));
} else if(!strcmp(key, "URL")) {
STRNCPY(info->url, ptr, sizeof(info->url));
} else if(!strcmp(key, "LICENSE")) {
- info->license = _alpm_list_add(info->license, strdup(ptr));
+ info->license = alpm_list_add(info->license, strdup(ptr));
} else if(!strcmp(key, "BUILDDATE")) {
STRNCPY(info->builddate, ptr, sizeof(info->builddate));
} else if(!strcmp(key, "BUILDTYPE")) {
@@ -250,17 +250,17 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
STRNCPY(tmp, ptr, sizeof(tmp));
info->isize = atol(ptr);
} else if(!strcmp(key, "DEPEND")) {
- info->depends = _alpm_list_add(info->depends, strdup(ptr));
+ info->depends = alpm_list_add(info->depends, strdup(ptr));
} else if(!strcmp(key, "REMOVE")) {
- info->removes = _alpm_list_add(info->removes, strdup(ptr));
+ info->removes = alpm_list_add(info->removes, strdup(ptr));
} else if(!strcmp(key, "CONFLICT")) {
- info->conflicts = _alpm_list_add(info->conflicts, strdup(ptr));
+ info->conflicts = alpm_list_add(info->conflicts, strdup(ptr));
} else if(!strcmp(key, "REPLACES")) {
- info->replaces = _alpm_list_add(info->replaces, strdup(ptr));
+ info->replaces = alpm_list_add(info->replaces, strdup(ptr));
} else if(!strcmp(key, "PROVIDES")) {
- info->provides = _alpm_list_add(info->provides, strdup(ptr));
+ info->provides = alpm_list_add(info->provides, strdup(ptr));
} else if(!strcmp(key, "BACKUP")) {
- info->backup = _alpm_list_add(info->backup, strdup(ptr));
+ info->backup = alpm_list_add(info->backup, strdup(ptr));
} else {
_alpm_log(PM_LOG_DEBUG, _("%s: syntax error in description file line %d"),
info->name[0] != '\0' ? info->name : "error", linenum);
@@ -369,7 +369,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
continue;
}
_alpm_strtrim(str);
- info->files = _alpm_list_add(info->files, strdup(str));
+ info->files = alpm_list_add(info->files, strdup(str));
}
FREE(str);
fclose(fp);
@@ -386,7 +386,7 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
/* no .FILELIST present in this package.. build the filelist the */
/* old-fashioned way, one at a time */
expath = strdup(archive_entry_pathname (entry));
- info->files = _alpm_list_add(info->files, expath);
+ info->files = alpm_list_add(info->files, expath);
}
}
@@ -417,12 +417,12 @@ error:
return(NULL);
}
-/* Test for existence of a package in a pmlist_t*
+/* Test for existence of a package in a alpm_list_t*
* of pmpkg_t*
*/
-pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack)
+pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack)
{
- pmlist_t *lp;
+ alpm_list_t *lp;
if(needle == NULL || haystack == NULL) {
return(NULL);
@@ -668,7 +668,7 @@ unsigned char alpm_pkg_get_reason(pmpkg_t *pkg)
return pkg->reason;
}
-pmlist_t *alpm_pkg_get_licenses(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -680,7 +680,7 @@ pmlist_t *alpm_pkg_get_licenses(pmpkg_t *pkg)
return pkg->license;
}
-pmlist_t *alpm_pkg_get_groups(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -693,7 +693,7 @@ pmlist_t *alpm_pkg_get_groups(pmpkg_t *pkg)
}
/* depends */
-pmlist_t *alpm_pkg_get_depends(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -705,7 +705,7 @@ pmlist_t *alpm_pkg_get_depends(pmpkg_t *pkg)
return pkg->depends;
}
-pmlist_t *alpm_pkg_get_removes(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_removes(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -717,7 +717,7 @@ pmlist_t *alpm_pkg_get_removes(pmpkg_t *pkg)
return pkg->removes;
}
-pmlist_t *alpm_pkg_get_requiredby(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_requiredby(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -729,7 +729,7 @@ pmlist_t *alpm_pkg_get_requiredby(pmpkg_t *pkg)
return pkg->requiredby;
}
-pmlist_t *alpm_pkg_get_conflicts(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_conflicts(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -741,7 +741,7 @@ pmlist_t *alpm_pkg_get_conflicts(pmpkg_t *pkg)
return pkg->conflicts;
}
-pmlist_t *alpm_pkg_get_provides(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_provides(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -753,7 +753,7 @@ pmlist_t *alpm_pkg_get_provides(pmpkg_t *pkg)
return pkg->provides;
}
-pmlist_t *alpm_pkg_get_replaces(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -765,7 +765,7 @@ pmlist_t *alpm_pkg_get_replaces(pmpkg_t *pkg)
return pkg->replaces;
}
-pmlist_t *alpm_pkg_get_files(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -778,7 +778,7 @@ pmlist_t *alpm_pkg_get_files(pmpkg_t *pkg)
return pkg->files;
}
-pmlist_t *alpm_pkg_get_backup(pmpkg_t *pkg)
+alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 0b11ae49..616131d5 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -69,17 +69,17 @@ struct __pmpkg_t {
unsigned char force;
time_t date;
unsigned char reason;
- pmlist_t *desc_localized;
- pmlist_t *license;
- pmlist_t *replaces;
- pmlist_t *groups;
- pmlist_t *files;
- pmlist_t *backup;
- pmlist_t *depends;
- pmlist_t *removes;
- pmlist_t *requiredby;
- pmlist_t *conflicts;
- pmlist_t *provides;
+ alpm_list_t *desc_localized;
+ alpm_list_t *license;
+ alpm_list_t *replaces;
+ alpm_list_t *groups;
+ alpm_list_t *files;
+ alpm_list_t *backup;
+ alpm_list_t *depends;
+ alpm_list_t *removes;
+ alpm_list_t *requiredby;
+ alpm_list_t *conflicts;
+ alpm_list_t *provides;
/* internal */
unsigned char origin;
void *data;
@@ -94,7 +94,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
void _alpm_pkg_free(void *data);
int _alpm_pkg_cmp(const void *p1, const void *p2);
pmpkg_t *_alpm_pkg_load(char *pkgfile);
-pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack);
+pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack);
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
diff --git a/lib/libalpm/provide.c b/lib/libalpm/provide.c
index e2d58952..91f827fb 100644
--- a/lib/libalpm/provide.c
+++ b/lib/libalpm/provide.c
@@ -24,16 +24,16 @@
#include <string.h>
/* pacman */
#include "cache.h"
-#include "list.h"
+#include "alpm_list.h"
#include "db.h"
#include "provide.h"
-/* return a pmlist_t of packages in "db" that provide "package"
+/* return a alpm_list_t of packages in "db" that provide "package"
*/
-pmlist_t *_alpm_db_whatprovides(pmdb_t *db, char *package)
+alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, char *package)
{
- pmlist_t *pkgs = NULL;
- pmlist_t *lp;
+ alpm_list_t *pkgs = NULL;
+ alpm_list_t *lp;
if(db == NULL || package == NULL || strlen(package) == 0) {
return(NULL);
@@ -42,8 +42,8 @@ pmlist_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)) {
- pkgs = _alpm_list_add(pkgs, info);
+ if(alpm_list_is_strin(package, info->provides)) {
+ pkgs = alpm_list_add(pkgs, info);
}
}
diff --git a/lib/libalpm/provide.h b/lib/libalpm/provide.h
index eb587003..7f249fff 100644
--- a/lib/libalpm/provide.h
+++ b/lib/libalpm/provide.h
@@ -22,10 +22,10 @@
#define _ALPM_PROVIDE_H
#include "db.h"
-#include "list.h"
+#include "alpm_list.h"
#include "config.h"
-pmlist_t *_alpm_db_whatprovides(pmdb_t *db, char *package);
+alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, char *package);
#endif /* _ALPM_PROVIDE_H */
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 2177a6da..e340dfc3 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -41,7 +41,7 @@
#include <errno.h>
#include <libintl.h>
/* pacman */
-#include "list.h"
+#include "alpm_list.h"
#include "trans.h"
#include "util.h"
#include "error.h"
@@ -78,7 +78,7 @@ 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_is_strin(info->name, handle->holdpkg)) {
int resp = 0;
QUESTION(trans, PM_TRANS_CONV_REMOVE_HOLDPKG, info, NULL, NULL, &resp);
if(!resp) {
@@ -87,14 +87,14 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
_alpm_log(PM_LOG_FLOW2, _("adding %s in the targets list"), info->name);
- trans->packages = _alpm_list_add(trans->packages, info);
+ trans->packages = alpm_list_add(trans->packages, info);
return(0);
}
-int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
+int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
{
- pmlist_t *lp;
+ alpm_list_t *lp;
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -107,13 +107,13 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
if(lp != NULL) {
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
while(lp) {
- pmlist_t *i;
+ alpm_list_t *i;
for(i = lp; i; i = i->next) {
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
pmpkg_t *info = _alpm_db_scan(db, miss->depend.name, INFRQ_ALL);
if(info) {
_alpm_log(PM_LOG_FLOW2, _("pulling %s in the targets list"), info->name);
- trans->packages = _alpm_list_add(trans->packages, info);
+ trans->packages = alpm_list_add(trans->packages, info);
} else {
_alpm_log(PM_LOG_ERROR, _("could not find %s in database -- skipping"),
miss->depend.name);
@@ -160,7 +160,7 @@ static int str_cmp(const void *s1, const void *s2)
/* Helper function for iterating through a package's file and deleting them
* Used by _alpm_remove_commit
*/
-static void unlink_file(pmpkg_t *info, pmlist_t *lp, pmlist_t *targ,
+static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
pmtrans_t *trans, int filenum, int *position)
{
struct stat buf;
@@ -177,7 +177,7 @@ static void unlink_file(pmpkg_t *info, pmlist_t *lp, pmlist_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_is_strin(file, handle->noupgrade) ) {
nb = 1;
}
}
@@ -198,7 +198,7 @@ static void unlink_file(pmpkg_t *info, pmlist_t *lp, pmlist_t *targ,
* see the big comment block in db_find_conflicts() for an
* explanation. */
int skipit = 0;
- pmlist_t *j;
+ alpm_list_t *j;
for ( j = trans->skiplist; j; j = j->next ) {
if ( !strcmp(file, (char*)j->data) ) {
skipit = 1;
@@ -222,8 +222,8 @@ static void unlink_file(pmpkg_t *info, pmlist_t *lp, pmlist_t *targ,
}
} else {
_alpm_log(PM_LOG_FLOW2, _("unlinking %s"), line);
- int list_count = _alpm_list_count(trans->packages); /* this way we don't have to call _alpm_list_count twice during PROGRESS */
- PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - _alpm_list_count(targ) + 1));
+ int list_count = alpm_list_count(trans->packages); /* this way we don't have to call alpm_list_count twice during PROGRESS */
+ PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - alpm_list_count(targ) + 1));
++(*position);
}
if (unlink(line) == -1) {
@@ -236,7 +236,7 @@ static void unlink_file(pmpkg_t *info, pmlist_t *lp, pmlist_t *targ,
int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
{
pmpkg_t *info;
- pmlist_t *targ, *lp;
+ alpm_list_t *targ, *lp;
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -262,11 +262,11 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
}
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
- int filenum = _alpm_list_count(info->files);
+ int filenum = alpm_list_count(info->files);
_alpm_log(PM_LOG_FLOW1, _("removing files"));
/* iterate through the list backwards, unlinking files */
- for(lp = _alpm_list_last(info->files); lp; lp = lp->prev) {
+ for(lp = alpm_list_last(info->files); lp; lp = lp->prev) {
unlink_file(info, lp, targ, trans, filenum, &position);
}
}
@@ -309,7 +309,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
depinfo = _alpm_db_get_pkgfromcache(db, depend.name);
if(depinfo == NULL) {
/* look for a provides package */
- pmlist_t *provides = _alpm_db_whatprovides(db, depend.name);
+ alpm_list_t *provides = _alpm_db_whatprovides(db, depend.name);
if(provides) {
/* TODO: should check _all_ packages listed in provides, not just
* the first one.
@@ -327,7 +327,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
/* Ensure package has the appropriate data */
_alpm_db_read(db, INFRQ_DEPENDS, depinfo);
/* splice out this entry from requiredby */
- depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, info->name, str_cmp, &vdata);
+ depinfo->requiredby = alpm_list_remove(depinfo->requiredby, info->name, str_cmp, &vdata);
data = vdata;
FREE(data);
_alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), depinfo->name);
@@ -337,7 +337,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
}
}
- PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, 100, _alpm_list_count(trans->packages), (_alpm_list_count(trans->packages) - _alpm_list_count(targ) +1));
+ PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, 100, alpm_list_count(trans->packages), (alpm_list_count(trans->packages) - alpm_list_count(targ) +1));
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
EVENT(trans, PM_TRANS_EVT_REMOVE_DONE, info, NULL);
}
diff --git a/lib/libalpm/remove.h b/lib/libalpm/remove.h
index 524e5faa..5ceba3b2 100644
--- a/lib/libalpm/remove.h
+++ b/lib/libalpm/remove.h
@@ -22,11 +22,11 @@
#define _ALPM_REMOVE_H
#include "db.h"
-#include "list.h"
+#include "alpm_list.h"
#include "trans.h"
int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
-int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data);
+int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data);
int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db);
#endif /* _ALPM_REMOVE_H */
diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c
index c37d8a12..6a6658f1 100644
--- a/lib/libalpm/server.c
+++ b/lib/libalpm/server.c
@@ -94,7 +94,7 @@ void _alpm_server_free(void *data)
*
* RETURN: 0 for successful download, 1 on error
*/
-int _alpm_downloadfiles(pmlist_t *servers, const char *localpath, pmlist_t *files)
+int _alpm_downloadfiles(alpm_list_t *servers, const char *localpath, alpm_list_t *files)
{
return(_alpm_downloadfiles_forreal(servers, localpath, files, NULL, NULL));
}
@@ -112,14 +112,14 @@ int _alpm_downloadfiles(pmlist_t *servers, const char *localpath, pmlist_t *file
* 1 if the mtimes are identical
* -1 on error
*/
-int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
- pmlist_t *files, const char *mtime1, char *mtime2)
+int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
+ alpm_list_t *files, const char *mtime1, char *mtime2)
{
int dltotal_bytes = 0;
- pmlist_t *lp;
+ alpm_list_t *lp;
int done = 0;
- pmlist_t *complete = NULL;
- pmlist_t *i;
+ alpm_list_t *complete = NULL;
+ alpm_list_t *i;
if(files == NULL) {
return(0);
@@ -137,7 +137,7 @@ int _alpm_downloadfiles_forreal(pmlist_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_is_strin(fn, complete)) {
continue;
}
@@ -196,7 +196,7 @@ int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
_alpm_time2string(ust.mtime, strtime);
if(strcmp(mtime1, strtime) == 0) {
_alpm_log(PM_LOG_DEBUG, _("mtimes are identical, skipping %s"), fn);
- complete = _alpm_list_add(complete, fn);
+ complete = alpm_list_add(complete, fn);
if(localf != NULL) {
fclose(localf);
}
@@ -246,7 +246,7 @@ int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
fclose(localf);
fclose(dlf);
rename(output, realfile);
- complete = _alpm_list_add(complete, fn);
+ complete = alpm_list_add(complete, fn);
} else {
int ret;
int usepart = 0;
@@ -298,7 +298,7 @@ int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
_alpm_log(PM_LOG_DEBUG, _("XferCommand command returned non-zero status code (%d)"), ret);
} else {
/* download was successful */
- complete = _alpm_list_add(complete, fn);
+ complete = alpm_list_add(complete, fn);
if(usepart) {
char fnpart[PATH_MAX];
/* rename "output.part" file to "output" file */
@@ -310,7 +310,7 @@ int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
}
}
- if(_alpm_list_count(complete) == _alpm_list_count(files)) {
+ if(alpm_list_count(complete) == alpm_list_count(files)) {
done = 1;
}
}
@@ -344,8 +344,8 @@ char *_alpm_fetch_pkgurl(char *target)
_alpm_log(PM_LOG_DEBUG, _(" %s is already in the current directory"), s_url->doc);
} else {
pmserver_t *server;
- pmlist_t *servers = NULL;
- pmlist_t *files;
+ alpm_list_t *servers = NULL;
+ alpm_list_t *files;
if((server = (pmserver_t *)malloc(sizeof(pmserver_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmserver_t));
@@ -357,9 +357,9 @@ char *_alpm_fetch_pkgurl(char *target)
server->s_url = s_url;
server->path = strdup(s_url->doc);
- servers = _alpm_list_add(servers, server);
+ servers = alpm_list_add(servers, server);
- files = _alpm_list_add(NULL, strdup(p));
+ files = alpm_list_add(NULL, strdup(p));
if(_alpm_downloadfiles(servers, ".", files)) {
_alpm_log(PM_LOG_WARNING, _("failed to download %s"), target);
return(NULL);
diff --git a/lib/libalpm/server.h b/lib/libalpm/server.h
index 80e9a7e1..63dd62ea 100644
--- a/lib/libalpm/server.h
+++ b/lib/libalpm/server.h
@@ -21,7 +21,7 @@
#ifndef _ALPM_SERVER_H
#define _ALPM_SERVER_H
-#include "list.h"
+#include "alpm_list.h"
#include "alpm.h"
#include <time.h>
@@ -40,9 +40,9 @@ struct __pmserver_t {
pmserver_t *_alpm_server_new(const char *url);
void _alpm_server_free(void *data);
-int _alpm_downloadfiles(pmlist_t *servers, const char *localpath, pmlist_t *files);
-int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
- pmlist_t *files, const char *mtime1, char *mtime2);
+int _alpm_downloadfiles(alpm_list_t *servers, const char *localpath, alpm_list_t *files);
+int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
+ alpm_list_t *files, const char *mtime1, char *mtime2);
char *_alpm_fetch_pkgurl(char *target);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 453347d7..a4f527ed 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -36,7 +36,7 @@
/* pacman */
#include "log.h"
#include "error.h"
-#include "list.h"
+#include "alpm_list.h"
#include "package.h"
#include "db.h"
#include "cache.h"
@@ -87,12 +87,12 @@ void _alpm_sync_free(void *data)
FREE(sync);
}
-/* Test for existence of a package in a pmlist_t* of pmsyncpkg_t*
+/* Test for existence of a package in a alpm_list_t* of pmsyncpkg_t*
* If found, return a pointer to the respective pmsyncpkg_t*
*/
-static pmsyncpkg_t *find_pkginsync(char *needle, pmlist_t *haystack)
+static pmsyncpkg_t *find_pkginsync(char *needle, alpm_list_t *haystack)
{
- pmlist_t *i;
+ alpm_list_t *i;
pmsyncpkg_t *sync = NULL;
int found = 0;
@@ -122,9 +122,9 @@ static int istoonew(pmpkg_t *pkg)
* (refactored from _alpm_sync_prepare)
*/
static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
- pmlist_t *dbs_sync)
+ alpm_list_t *dbs_sync)
{
- pmlist_t *i, *j, *k;
+ alpm_list_t *i, *j, *k;
/* check for "recommended" package replacements */
_alpm_log(PM_LOG_FLOW1, _("checking for package replacements"));
@@ -132,12 +132,12 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
for(j = _alpm_db_get_pkgcache(i->data, INFRQ_DESC); j; j = j->next) {
pmpkg_t *spkg = j->data;
for(k = spkg->replaces; k; k = k->next) {
- pmlist_t *m;
+ alpm_list_t *m;
for(m = _alpm_db_get_pkgcache(db_local, INFRQ_NONE); m; m = m->next) {
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_is_strin(lpkg->name, handle->ignorepkg)) {
_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 {
@@ -155,12 +155,12 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
pm_errno = PM_ERR_MEMORY;
goto error;
}
- dummy->requiredby = _alpm_list_strdup(lpkg->requiredby);
+ dummy->requiredby = alpm_list_strdup(lpkg->requiredby);
/* check if spkg->name is already in the packages list. */
sync = find_pkginsync(spkg->name, trans->packages);
if(sync) {
/* found it -- just append to the replaces list */
- sync->data = _alpm_list_add(sync->data, dummy);
+ sync->data = alpm_list_add(sync->data, dummy);
} else {
/* none found -- enter pkg into the final sync list */
sync = _alpm_sync_new(PM_SYNC_TYPE_REPLACE, spkg, NULL);
@@ -169,8 +169,8 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
pm_errno = PM_ERR_MEMORY;
goto error;
}
- sync->data = _alpm_list_add(NULL, dummy);
- trans->packages = _alpm_list_add(trans->packages, sync);
+ sync->data = alpm_list_add(NULL, dummy);
+ trans->packages = alpm_list_add(trans->packages, sync);
}
_alpm_log(PM_LOG_FLOW2, _("%s-%s elected for upgrade (to be replaced by %s-%s)"),
lpkg->name, lpkg->version, spkg->name, spkg->version);
@@ -187,9 +187,9 @@ error:
return(-1);
}
-int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync)
+int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync)
{
- pmlist_t *i, *j;
+ alpm_list_t *i, *j;
/* check for "recommended" package replacements */
_alpm_log(PM_LOG_FLOW1, _("checking for package replacements"));
@@ -235,7 +235,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync
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_is_strin(spkg->name, handle->ignorepkg)) {
/* package should be ignored (IgnorePkg) */
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
local->name, local->version, spkg->version);
@@ -257,7 +257,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync
FREEPKG(dummy);
goto error;
}
- trans->packages = _alpm_list_add(trans->packages, sync);
+ trans->packages = alpm_list_add(trans->packages, sync);
} else {
/* spkg->name is already in the packages list -- just ignore it */
}
@@ -271,11 +271,11 @@ error:
return(-1);
}
-int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, char *name)
+int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, char *name)
{
char targline[PKG_FULLNAME_LEN];
char *targ;
- pmlist_t *j;
+ alpm_list_t *j;
pmpkg_t *local;
pmpkg_t *spkg = NULL;
pmsyncpkg_t *sync;
@@ -298,7 +298,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync,
spkg = _alpm_db_get_pkgfromcache(dbs, targ);
if(spkg == NULL) {
/* Search provides */
- pmlist_t *p;
+ alpm_list_t *p;
_alpm_log(PM_LOG_FLOW2, _("target '%s' not found -- looking for provisions"), targ);
p = _alpm_db_whatprovides(dbs, targ);
if(p == NULL) {
@@ -325,7 +325,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync,
_alpm_log(PM_LOG_FLOW2, _("target '%s' not found -- looking for provisions"), targ);
for(j = dbs_sync; j && !spkg; j = j->next) {
pmdb_t *dbs = j->data;
- pmlist_t *p = _alpm_db_whatprovides(dbs, targ);
+ alpm_list_t *p = _alpm_db_whatprovides(dbs, targ);
if(p) {
_alpm_log(PM_LOG_DEBUG, _("found '%s' as a provision for '%s'"), p->data, targ);
spkg = _alpm_db_get_pkgfromcache(dbs, p->data);
@@ -375,13 +375,13 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync,
RET_ERR(PM_ERR_MEMORY, -1);
}
_alpm_log(PM_LOG_FLOW2, _("adding target '%s' to the transaction set"), spkg->name);
- trans->packages = _alpm_list_add(trans->packages, sync);
+ trans->packages = alpm_list_add(trans->packages, sync);
}
return(0);
}
-/* Helper functions for _alpm_list_remove
+/* Helper functions for alpm_list_remove
*/
/* removed - use pkg_cmp all of the time
static int ptr_cmp(const void *s1, const void *s2)
@@ -394,13 +394,13 @@ static int pkg_cmp(const void *p1, const void *p2)
return(strcmp(((pmpkg_t *)p1)->name, ((pmsyncpkg_t *)p2)->pkg->name));
}
-int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, pmlist_t **data)
+int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, alpm_list_t **data)
{
- pmlist_t *deps = NULL;
- pmlist_t *list = NULL; /* list allowing checkdeps usage with data from trans->packages */
- pmlist_t *trail = NULL; /* breadcrumb list to avoid running into circles */
- pmlist_t *asked = NULL;
- pmlist_t *i, *j, *k, *l;
+ alpm_list_t *deps = NULL;
+ alpm_list_t *list = NULL; /* list allowing checkdeps usage with data from trans->packages */
+ alpm_list_t *trail = NULL; /* breadcrumb list to avoid running into circles */
+ alpm_list_t *asked = NULL;
+ alpm_list_t *i, *j, *k, *l;
int ret = 0;
ASSERT(db_local != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
@@ -412,11 +412,11 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
- list = _alpm_list_add(list, sync->pkg);
+ list = alpm_list_add(list, sync->pkg);
}
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
- trail = _alpm_list_new();
+ trail = alpm_list_new();
/* Resolve targets dependencies */
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
@@ -439,7 +439,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
ret = -1;
goto cleanup;
}
- trans->packages = _alpm_list_add(trans->packages, sync);
+ trans->packages = alpm_list_add(trans->packages, sync);
_alpm_log(PM_LOG_FLOW2, _("adding package %s-%s to the transaction targets"),
spkg->name, spkg->version);
} else {
@@ -447,7 +447,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
if((trans->flags & PM_TRANS_FLAG_DEPENDSONLY)) {
void *vp;
pmpkg_t *p;
- trans->packages = _alpm_list_remove(trans->packages, spkg, pkg_cmp, &vp);
+ trans->packages = alpm_list_remove(trans->packages, spkg, pkg_cmp, &vp);
p = vp;
FREEPKG(p);
}
@@ -458,14 +458,14 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
k = l = NULL;
for(i=trans->packages; i; i=i->next) {
pmsyncpkg_t *s = (pmsyncpkg_t*)i->data;
- k = _alpm_list_add(k, s->pkg);
+ k = alpm_list_add(k, s->pkg);
}
k = _alpm_sortbydeps(k, PM_TRANS_TYPE_ADD);
for(i=k; i; i=i->next) {
for(j=trans->packages; j; j=j->next) {
pmsyncpkg_t *s = (pmsyncpkg_t*)j->data;
if(s->pkg==i->data) {
- l = _alpm_list_add(l, s);
+ l = alpm_list_add(l, s);
}
}
}
@@ -535,7 +535,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
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_is_strin(miss->depend.name, sync->pkg->provides)) {
/* 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, pmlist_t *dbs_sync, p
/* 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_is_strin(miss->target, trans->targets);
+ depend = alpm_list_is_strin(miss->depend.name, trans->targets);
if(depend && !target) {
_alpm_log(PM_LOG_DEBUG, _("'%s' is in the target list -- keeping it"),
miss->depend.name);
@@ -580,7 +580,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
pmsyncpkg_t *rsync = find_pkginsync(rmpkg, trans->packages);
void *vpkg;
_alpm_log(PM_LOG_FLOW2, _("removing '%s' from target list"), rmpkg);
- trans->packages = _alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
+ trans->packages = alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
FREESYNC(vpkg);
continue;
}
@@ -591,9 +591,9 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
_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_is_strin(miss->depend.name, asked)) {
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &doremove);
- asked = _alpm_list_add(asked, strdup(miss->depend.name));
+ asked = alpm_list_add(asked, strdup(miss->depend.name));
if(doremove) {
pmsyncpkg_t *rsync = find_pkginsync(miss->depend.name, trans->packages);
pmpkg_t *q = _alpm_pkg_new(miss->depend.name, NULL);
@@ -604,7 +604,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
ret = -1;
goto cleanup;
}
- q->requiredby = _alpm_list_strdup(local->requiredby);
+ q->requiredby = alpm_list_strdup(local->requiredby);
if(sync->type != PM_SYNC_TYPE_REPLACE) {
/* switch this sync type to REPLACE */
sync->type = PM_SYNC_TYPE_REPLACE;
@@ -612,12 +612,12 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
}
/* append to the replaces list */
_alpm_log(PM_LOG_FLOW2, _("electing '%s' for removal"), miss->depend.name);
- sync->data = _alpm_list_add(sync->data, q);
+ sync->data = alpm_list_add(sync->data, q);
if(rsync) {
/* remove it from the target list */
void *vpkg;
_alpm_log(PM_LOG_FLOW2, _("removing '%s' from target list"), miss->depend.name);
- trans->packages = _alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
+ trans->packages = alpm_list_remove(trans->packages, rsync, pkg_cmp, &vpkg);
FREESYNC(vpkg);
}
} else {
@@ -633,7 +633,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
goto cleanup;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = _alpm_list_add(*data, miss);
+ *data = alpm_list_add(*data, miss);
}
}
}
@@ -649,7 +649,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
goto cleanup;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = _alpm_list_add(*data, miss);
+ *data = alpm_list_add(*data, miss);
}
}
}
@@ -685,7 +685,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
for(j = sync->data; j; j = j->next) {
- list = _alpm_list_add(list, j->data);
+ list = alpm_list_add(list, j->data);
}
}
}
@@ -698,7 +698,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
pmdepmissing_t *miss = i->data;
if(!find_pkginsync(miss->depend.name, trans->packages)) {
int pfound = 0;
- pmlist_t *k;
+ alpm_list_t *k;
/* If miss->depend.name depends on something that miss->target and a
* package in final both provide, then it's okay... */
pmpkg_t *leavingp = _alpm_db_get_pkgfromcache(db_local, miss->target);
@@ -711,13 +711,13 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
/* Look through the upset package's dependencies and try to match one up
* to a provisio from the package we want to remove */
for(k = conflictp->depends; k && !pfound; k = k->next) {
- pmlist_t *m;
+ alpm_list_t *m;
for(m = leavingp->provides; m && !pfound; m = m->next) {
if(!strcmp(k->data, m->data)) {
/* Found a match -- now look through final for a package that
* provides the same thing. If none are found, then it truly
* is an unresolvable conflict. */
- pmlist_t *n, *o;
+ alpm_list_t *n, *o;
for(n = trans->packages; n && !pfound; n = n->next) {
pmsyncpkg_t *sp = n->data;
for(o = sp->pkg->provides; o && !pfound; o = o->next) {
@@ -745,7 +745,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, p
goto cleanup;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = _alpm_list_add(*data, miss);
+ *data = alpm_list_add(*data, miss);
}
}
}
@@ -780,9 +780,9 @@ cleanup:
return(ret);
}
-int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
+int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
{
- pmlist_t *i, *j, *files = NULL;
+ alpm_list_t *i, *j, *files = NULL;
pmtrans_t *tr = NULL;
int replaces = 0, retval = 0;
char ldir[PATH_MAX];
@@ -815,7 +815,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
snprintf(path, PATH_MAX, "%s/%s", ldir, fname);
if(stat(path, &buf)) {
/* file is not in the cache dir, so add it to the list */
- files = _alpm_list_add(files, strdup(fname));
+ files = alpm_list_add(files, strdup(fname));
} else {
_alpm_log(PM_LOG_DEBUG, _("%s is already in the cache\n"), fname);
}
@@ -872,7 +872,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
RET_ERR(PM_ERR_MEMORY, -1);
}
snprintf(ptr, 512, _("can't get md5 or sha1 checksum for package %s\n"), pkgname);
- *data = _alpm_list_add(*data, ptr);
+ *data = alpm_list_add(*data, ptr);
retval = 1;
continue;
}
@@ -884,7 +884,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
RET_ERR(PM_ERR_MEMORY, -1);
}
snprintf(ptr, 512, _("can't get md5 or sha1 checksum for package %s\n"), pkgname);
- *data = _alpm_list_add(*data, ptr);
+ *data = alpm_list_add(*data, ptr);
retval = 1;
continue;
}
@@ -906,7 +906,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
} else {
snprintf(ptr, 512, _("archive %s is corrupted (bad MD5 or SHA1 checksum)\n"), pkgname);
}
- *data = _alpm_list_add(*data, ptr);
+ *data = alpm_list_add(*data, ptr);
retval = 1;
}
FREE(md5sum2);
@@ -938,7 +938,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
- pmlist_t *j;
+ 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)) {
@@ -989,9 +989,9 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
if(_alpm_trans_addtarget(tr, str) == -1) {
goto error;
}
- /* using _alpm_list_last() is ok because addtarget() adds the new target at the
+ /* using alpm_list_last() is ok because addtarget() adds the new target at the
* end of the tr->packages list */
- spkg = _alpm_list_last(tr->packages)->data;
+ spkg = alpm_list_last(tr->packages)->data;
if(sync->type == PM_SYNC_TYPE_DEPEND) {
spkg->reason = PM_PKG_REASON_DEPEND;
}
@@ -1013,16 +1013,16 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
- pmlist_t *j;
+ alpm_list_t *j;
pmpkg_t *new = _alpm_db_get_pkgfromcache(db_local, sync->pkg->name);
for(j = sync->data; j; j = j->next) {
- pmlist_t *k;
+ alpm_list_t *k;
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_is_strin(k->data, new->requiredby)) {
/* replace old's name with new's name in the requiredby's dependency list */
- pmlist_t *m;
+ alpm_list_t *m;
pmpkg_t *depender = _alpm_db_get_pkgfromcache(db_local, k->data);
if(depender == NULL) {
/* If the depending package no longer exists in the local db,
@@ -1042,7 +1042,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
new->name, new->version);
}
/* add the new requiredby */
- new->requiredby = _alpm_list_add(new->requiredby, strdup(k->data));
+ new->requiredby = alpm_list_add(new->requiredby, strdup(k->data));
}
}
}
diff --git a/lib/libalpm/sync.h b/lib/libalpm/sync.h
index f3d5ec02..c01afd64 100644
--- a/lib/libalpm/sync.h
+++ b/lib/libalpm/sync.h
@@ -37,10 +37,10 @@ struct __pmsyncpkg_t {
pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data);
void _alpm_sync_free(void *data);
-int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync);
-int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, char *name);
-int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, pmlist_t *dbs_sync, pmlist_t **data);
-int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data);
+int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync);
+int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, char *name);
+int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, alpm_list_t **data);
+int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data);
#endif /* _ALPM_SYNC_H */
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 8def650f..20425b63 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -32,7 +32,7 @@
#include "package.h"
#include "util.h"
#include "log.h"
-#include "list.h"
+#include "alpm_list.h"
#include "handle.h"
#include "add.h"
#include "remove.h"
@@ -71,7 +71,7 @@ void _alpm_trans_free(void *data)
FREELIST(trans->targets);
if(trans->type == PM_TRANS_TYPE_SYNC) {
- pmlist_t *i;
+ alpm_list_t *i;
for(i = trans->packages; i; i = i->next) {
FREESYNC(i->data);
}
@@ -114,7 +114,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_is_strin(target, trans->targets)) {
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
}
@@ -140,12 +140,12 @@ int _alpm_trans_addtarget(pmtrans_t *trans, char *target)
break;
}
- trans->targets = _alpm_list_add(trans->targets, strdup(target));
+ trans->targets = alpm_list_add(trans->targets, strdup(target));
return(0);
}
-int _alpm_trans_prepare(pmtrans_t *trans, pmlist_t **data)
+int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data)
{
*data = NULL;
@@ -184,7 +184,7 @@ int _alpm_trans_prepare(pmtrans_t *trans, pmlist_t **data)
return(0);
}
-int _alpm_trans_commit(pmtrans_t *trans, pmlist_t **data)
+int _alpm_trans_commit(pmtrans_t *trans, alpm_list_t **data)
{
if(data!=NULL)
*data = NULL;
@@ -244,7 +244,7 @@ unsigned int alpm_trans_get_flags()
return handle->trans->flags;
}
-pmlist_t * alpm_trans_get_targets()
+alpm_list_t * alpm_trans_get_targets()
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
@@ -253,7 +253,7 @@ pmlist_t * alpm_trans_get_targets()
return handle->trans->targets;
}
-pmlist_t * alpm_trans_get_packages()
+alpm_list_t * alpm_trans_get_packages()
{
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h
index 49bcceb3..2fcec2ed 100644
--- a/lib/libalpm/trans.h
+++ b/lib/libalpm/trans.h
@@ -31,9 +31,9 @@ struct __pmtrans_t {
unsigned char type;
unsigned int flags;
unsigned char state;
- pmlist_t *targets; /* pmlist_t of (char *) */
- pmlist_t *packages; /* pmlist_t of (pmpkg_t *) or (pmsyncpkg_t *) */
- pmlist_t *skiplist; /* pmlist_t of (char *) */
+ alpm_list_t *targets; /* alpm_list_t of (char *) */
+ alpm_list_t *packages; /* alpm_list_t of (pmpkg_t *) or (pmsyncpkg_t *) */
+ alpm_list_t *skiplist; /* alpm_list_t of (char *) */
alpm_trans_cb_event cb_event;
alpm_trans_cb_conv cb_conv;
alpm_trans_cb_progress cb_progress;
@@ -80,8 +80,8 @@ void _alpm_trans_free(void *data);
int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress);
int _alpm_trans_sysupgrade(pmtrans_t *trans);
int _alpm_trans_addtarget(pmtrans_t *trans, char *target);
-int _alpm_trans_prepare(pmtrans_t *trans, pmlist_t **data);
-int _alpm_trans_commit(pmtrans_t *trans, pmlist_t **data);
+int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data);
+int _alpm_trans_commit(pmtrans_t *trans, alpm_list_t **data);
#endif /* _ALPM_TRANS_H */
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 074d16f1..ad7bf8ee 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -55,8 +55,8 @@
#endif
/* pacman */
+#include "alpm_list.h"
#include "log.h"
-#include "list.h"
#include "trans.h"
#include "sync.h"
#include "util.h"
@@ -563,9 +563,9 @@ static long long get_freespace()
return(ret);
}
-int _alpm_check_freespace(pmtrans_t *trans, pmlist_t **data)
+int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data)
{
- pmlist_t *i;
+ alpm_list_t *i;
long long pkgsize=0, freespace;
for(i = trans->packages; i; i = i->next) {
@@ -594,7 +594,7 @@ int _alpm_check_freespace(pmtrans_t *trans, pmlist_t **data)
return(-1);
}
*ptr = pkgsize;
- *data = _alpm_list_add(*data, ptr);
+ *data = alpm_list_add(*data, ptr);
if((ptr = (long long*)malloc(sizeof(long long)))==NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long));
FREELIST(*data);
@@ -602,7 +602,7 @@ int _alpm_check_freespace(pmtrans_t *trans, pmlist_t **data)
return(-1);
}
*ptr = freespace;
- *data = _alpm_list_add(*data, ptr);
+ *data = alpm_list_add(*data, ptr);
}
pm_errno = PM_ERR_DISK_FULL;
return(-1);
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 73e1c14e..378233d2 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -67,7 +67,7 @@ int _alpm_ldconfig(char *root);
#ifdef _ALPM_TRANS_H
int _alpm_runscriptlet(char *util, char *installfn, char *script, char *ver, char *oldver, pmtrans_t *trans);
#ifndef __sun__
-int _alpm_check_freespace(pmtrans_t *trans, pmlist_t **data);
+int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data);
#endif
#endif
void _alpm_time2string(time_t t, char *buffer);
diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c
index 4e31ca51..045f2a24 100644
--- a/lib/libalpm/versioncmp.c
+++ b/lib/libalpm/versioncmp.c
@@ -31,7 +31,7 @@
#include "alpm.h"
#include "log.h"
#include "util.h"
-#include "list.h"
+#include "alpm_list.h"
#include "versioncmp.h"
#ifndef HAVE_STRVERSCMP
@@ -247,7 +247,7 @@ 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_is_strin(dep->name, pkg->provides)) {
if(dep->mod == PM_DEP_MOD_ANY) {
equal = 1;
} else {