Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 002b1c89..83a2fb8f 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -295,7 +295,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
return pkg->groups;
}
-unsigned short SYMEXPORT alpm_pkg_has_force(pmpkg_t *pkg)
+int SYMEXPORT alpm_pkg_has_force(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -423,13 +423,6 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg)
return pkg->backup;
}
-alpm_list_t SYMEXPORT *alpm_pkg_get_removes(pmpkg_t *pkg)
-{
- ASSERT(pkg != NULL, return(NULL));
-
- return(pkg->removes);
-}
-
pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
{
/* Sanity checks */
@@ -548,7 +541,7 @@ int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp)
return(ret);
}
-unsigned short SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
+int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -580,7 +573,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
}
pmpkg_t *cachepkg = i->data;
if(_alpm_dep_edge(cachepkg, pkg)) {
- const char *cachepkgname = alpm_pkg_get_name(cachepkg);
+ const char *cachepkgname = pkg->name;
reqs = alpm_list_add(reqs, strdup(cachepkgname));
}
}
@@ -858,7 +851,11 @@ void _alpm_pkg_free(pmpkg_t *pkg)
FREE(pkg);
}
-/* Free transaction specific fields */
+/* This function should be used when removing a target from upgrade/sync target list
+ * Case 1: If pkg is a loaded package file (PKG_FROM_FILE), it will be freed.
+ * Case 2: If pkg is a pkgcache entry (PKG_FROM_CACHE), it won't be freed,
+ * only the transaction specific fields of pkg will be freed.
+ */
void _alpm_pkg_free_trans(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -867,6 +864,11 @@ void _alpm_pkg_free_trans(pmpkg_t *pkg)
return;
}
+ if(pkg->origin == PKG_FROM_FILE) {
+ _alpm_pkg_free(pkg);
+ return;
+ }
+
alpm_list_free(pkg->removes);
pkg->removes = NULL;
}
@@ -894,7 +896,7 @@ int _alpm_pkg_cmp(const void *p1, const void *p2)
{
pmpkg_t *pkg1 = (pmpkg_t *)p1;
pmpkg_t *pkg2 = (pmpkg_t *)p2;
- return(strcmp(alpm_pkg_get_name(pkg1), alpm_pkg_get_name(pkg2)));
+ return(strcmp(pkg1->name, pkg2->name));
}
/* Test for existence of a package in a alpm_list_t*
@@ -913,7 +915,7 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
for(lp = haystack; lp; lp = lp->next) {
pmpkg_t *info = lp->data;
- if(info && strcmp(alpm_pkg_get_name(info), needle) == 0) {
+ if(info && strcmp(info->name, needle) == 0) {
return(info);
}
}