deps.c: pass alpm_list** to _alpm_recursedeps

Improves consistency and makes it clear that targs will be modified by
_alpm_recursedeps.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2013-10-25 23:20:24 -04:00 committed by Allan McRae
parent 08191b13f2
commit c3493360af
3 changed files with 7 additions and 7 deletions

View file

@ -589,7 +589,7 @@ static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
* @param include_explicit if 0, explicitly installed packages are not included * @param include_explicit if 0, explicitly installed packages are not included
* @return 0 on success, -1 on errors * @return 0 on success, -1 on errors
*/ */
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit) int _alpm_recursedeps(alpm_db_t *db, alpm_list_t **targs, int include_explicit)
{ {
alpm_list_t *i, *j; alpm_list_t *i, *j;
@ -597,12 +597,12 @@ int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit)
return -1; return -1;
} }
for(i = targs; i; i = i->next) { for(i = *targs; i; i = i->next) {
alpm_pkg_t *pkg = i->data; alpm_pkg_t *pkg = i->data;
for(j = _alpm_db_get_pkgcache(db); j; j = j->next) { for(j = _alpm_db_get_pkgcache(db); j; j = j->next) {
alpm_pkg_t *deppkg = j->data; alpm_pkg_t *deppkg = j->data;
if(_alpm_pkg_depends_on(pkg, deppkg) if(_alpm_pkg_depends_on(pkg, deppkg)
&& can_remove_package(db, deppkg, targs, include_explicit)) { && can_remove_package(db, deppkg, *targs, include_explicit)) {
alpm_pkg_t *copy; alpm_pkg_t *copy;
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding '%s' to the targets\n", _alpm_log(db->handle, ALPM_LOG_DEBUG, "adding '%s' to the targets\n",
deppkg->name); deppkg->name);
@ -610,7 +610,7 @@ int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit)
if(_alpm_pkg_dup(deppkg, &copy)) { if(_alpm_pkg_dup(deppkg, &copy)) {
return -1; return -1;
} }
targs = alpm_list_add(targs, copy); *targs = alpm_list_add(*targs, copy);
} }
} }
} }

View file

@ -32,7 +32,7 @@ alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
void _alpm_depmiss_free(alpm_depmissing_t *miss); void _alpm_depmiss_free(alpm_depmissing_t *miss);
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
alpm_list_t *targets, alpm_list_t *ignore, int reverse); alpm_list_t *targets, alpm_list_t *ignore, int reverse);
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit); int _alpm_recursedeps(alpm_db_t *db, alpm_list_t **targs, int include_explicit);
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg, int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg,
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove, alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
alpm_list_t **data); alpm_list_t **data);

View file

@ -207,7 +207,7 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
if((trans->flags & ALPM_TRANS_FLAG_RECURSE) if((trans->flags & ALPM_TRANS_FLAG_RECURSE)
&& !(trans->flags & ALPM_TRANS_FLAG_CASCADE)) { && !(trans->flags & ALPM_TRANS_FLAG_CASCADE)) {
_alpm_log(handle, ALPM_LOG_DEBUG, "finding removable dependencies\n"); _alpm_log(handle, ALPM_LOG_DEBUG, "finding removable dependencies\n");
if(_alpm_recursedeps(db, trans->remove, if(_alpm_recursedeps(db, &trans->remove,
trans->flags & ALPM_TRANS_FLAG_RECURSEALL)) { trans->flags & ALPM_TRANS_FLAG_RECURSEALL)) {
return -1; return -1;
} }
@ -251,7 +251,7 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
if((trans->flags & ALPM_TRANS_FLAG_CASCADE) if((trans->flags & ALPM_TRANS_FLAG_CASCADE)
&& (trans->flags & ALPM_TRANS_FLAG_RECURSE)) { && (trans->flags & ALPM_TRANS_FLAG_RECURSE)) {
_alpm_log(handle, ALPM_LOG_DEBUG, "finding removable dependencies\n"); _alpm_log(handle, ALPM_LOG_DEBUG, "finding removable dependencies\n");
if(_alpm_recursedeps(db, trans->remove, if(_alpm_recursedeps(db, &trans->remove,
trans->flags & ALPM_TRANS_FLAG_RECURSEALL)) { trans->flags & ALPM_TRANS_FLAG_RECURSEALL)) {
return -1; return -1;
} }