mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
libalpm/package.c : add _alpm_pkgname_pkg_cmp function.
_alpm_pkgname_pkg_cmp(pkgname, pkg) returns true iff pkg's name is pkgname. This is useful if you want to remove a package from pmpkg_t* list, and you want to search for package name. This allows cleaning the -Ru code a bit, by removing the need of a dummy pkg. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This commit is contained in:
parent
e63366ae5e
commit
05d5634958
@ -895,6 +895,12 @@ int _alpm_pkg_cmp(const void *p1, const void *p2)
|
|||||||
return(strcmp(alpm_pkg_get_name(pk1), alpm_pkg_get_name(pk2)));
|
return(strcmp(alpm_pkg_get_name(pk1), alpm_pkg_get_name(pk2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _alpm_pkgname_pkg_cmp(const void *pkgname, const void *package)
|
||||||
|
{
|
||||||
|
return(strcmp(alpm_pkg_get_name((pmpkg_t *) package), (char *) pkgname));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Parses the package description file for the current package
|
/* Parses the package description file for the current package
|
||||||
* TODO: this should ALL be in a backend interface (be_files), we should
|
* TODO: this should ALL be in a backend interface (be_files), we should
|
||||||
* be dealing with the abstracted concepts only in this file
|
* be dealing with the abstracted concepts only in this file
|
||||||
|
@ -77,6 +77,7 @@ pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
|
|||||||
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
|
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
|
||||||
void _alpm_pkg_free(pmpkg_t *pkg);
|
void _alpm_pkg_free(pmpkg_t *pkg);
|
||||||
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
||||||
|
int _alpm_pkgname_pkg_cmp(const void *pkgname, const void *package);
|
||||||
int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
|
int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
|
||||||
pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full);
|
pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full);
|
||||||
pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
|
pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack);
|
||||||
|
@ -132,10 +132,8 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
|
|||||||
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
|
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
|
||||||
void *vpkg;
|
void *vpkg;
|
||||||
pmpkg_t *pkg;
|
pmpkg_t *pkg;
|
||||||
pmpkg_t *dummy = _alpm_pkg_new(miss->causingpkg, NULL);
|
trans->packages = alpm_list_remove(trans->packages, miss->causingpkg,
|
||||||
trans->packages = alpm_list_remove(trans->packages, dummy,
|
_alpm_pkgname_pkg_cmp, &vpkg);
|
||||||
_alpm_pkg_cmp, &vpkg);
|
|
||||||
_alpm_pkg_free(dummy);
|
|
||||||
pkg = vpkg;
|
pkg = vpkg;
|
||||||
if(pkg) {
|
if(pkg) {
|
||||||
_alpm_log(PM_LOG_WARNING, "removing %s from the target-list\n",
|
_alpm_log(PM_LOG_WARNING, "removing %s from the target-list\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user