summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-05-14 02:03:54 +0200
committerDan McGee <dan@archlinux.org>2008-05-14 02:03:54 +0200
commitdd98aa8564a21ed43782704bf9feb5b2b114825f (patch)
tree685c35186dc19109865957abc5f384dd606d3df9
parenta422f6e39c9c60b89269c2b09e697a9eb142b904 (diff)
downloadpacman-dd98aa8564a21ed43782704bf9feb5b2b114825f.tar.gz
pacman-dd98aa8564a21ed43782704bf9feb5b2b114825f.tar.xz
Simplify _alpm_pkg_new()
Any real call of this function doesn't specify a name or version ahead of time, so just kill that functionality off. Now to remove those dummy packages... Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/be_files.c2
-rw-r--r--lib/libalpm/be_package.c2
-rw-r--r--lib/libalpm/deps.c6
-rw-r--r--lib/libalpm/package.c10
-rw-r--r--lib/libalpm/package.h2
5 files changed, 8 insertions, 14 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 256a7d0c..65196e99 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -298,7 +298,7 @@ int _alpm_db_populate(pmdb_t *db)
continue;
}
- pkg = _alpm_pkg_new(NULL, NULL);
+ pkg = _alpm_pkg_new();
if(pkg == NULL) {
return(-1);
}
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 599ec625..85112fd4 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -156,7 +156,7 @@ static pmpkg_t *pkg_load(const char *pkgfile, unsigned short full)
RET_ERR(PM_ERR_PKG_OPEN, NULL);
}
- newpkg = _alpm_pkg_new(NULL, NULL);
+ newpkg = _alpm_pkg_new();
if(newpkg == NULL) {
archive_read_finish(archive);
RET_ERR(PM_ERR_MEMORY, NULL);
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 818418e2..55e24388 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -598,7 +598,8 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
}
/* If package is in the ignorepkg list, ask before we pull it */
if(_alpm_pkg_should_ignore(sync)) {
- pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
+ pmpkg_t *dummypkg = _alpm_pkg_new();
+ STRDUP(dummypkg->name, miss->target, RET_ERR(PM_ERR_MEMORY, -1));
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &found);
_alpm_pkg_free(dummypkg);
}
@@ -620,7 +621,8 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
continue;
}
if(_alpm_pkg_should_ignore(sync)) {
- pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
+ pmpkg_t *dummypkg = _alpm_pkg_new();
+ STRDUP(dummypkg->name, miss->target, RET_ERR(PM_ERR_MEMORY, -1));
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &found);
_alpm_pkg_free(dummypkg);
}
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 86596165..14c1df13 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -680,7 +680,7 @@ int _alpm_versioncmp(const char *a, const char *b)
}
-pmpkg_t *_alpm_pkg_new(const char *name, const char *version)
+pmpkg_t *_alpm_pkg_new(void)
{
pmpkg_t* pkg;
@@ -688,14 +688,6 @@ pmpkg_t *_alpm_pkg_new(const char *name, const char *version)
CALLOC(pkg, 1, sizeof(pmpkg_t), RET_ERR(PM_ERR_MEMORY, NULL));
- if(name) {
- STRDUP(pkg->name, name, RET_ERR(PM_ERR_MEMORY, pkg));
- }
-
- if(version) {
- STRDUP(pkg->version, version, RET_ERR(PM_ERR_MEMORY, pkg));
- }
-
return(pkg);
}
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index e1847ec7..ccb1c3b6 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -75,7 +75,7 @@ struct __pmpkg_t {
};
int _alpm_versioncmp(const char *a, const char *b);
-pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
+pmpkg_t* _alpm_pkg_new(void);
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
void _alpm_pkg_free(pmpkg_t *pkg);
int _alpm_pkg_cmp(const void *p1, const void *p2);