diff options
author | Dan McGee <dan@archlinux.org> | 2011-03-25 20:45:42 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-25 21:40:12 +0100 |
commit | 3bc3999bd25647f9b64ea4b4995cad54a8066cc1 (patch) | |
tree | 6e0fc52722bd5766fdc50c08740f90e68345c68b | |
parent | 5a9a570dda81148fd9ce8ea46b3c57befa8535fe (diff) | |
download | pacman-3bc3999bd25647f9b64ea4b4995cad54a8066cc1.tar.gz pacman-3bc3999bd25647f9b64ea4b4995cad54a8066cc1.tar.xz |
Mark various functions in deps.c static
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | lib/libalpm/deps.c | 54 | ||||
-rw-r--r-- | lib/libalpm/deps.h | 5 |
2 files changed, 27 insertions, 32 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 1f1e637f..2c2637ac 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -43,7 +43,7 @@ void _alpm_dep_free(pmdepend_t *dep) FREE(dep); } -pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep, +static pmdepmissing_t *depmiss_new(const char *target, pmdepend_t *dep, const char *causingpkg) { pmdepmissing_t *miss; @@ -67,6 +67,18 @@ void _alpm_depmiss_free(pmdepmissing_t *miss) FREE(miss); } +/* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */ +static int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2) +{ + alpm_list_t *i; + for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) { + if(_alpm_depcmp(pkg2, i->data)) { + return(1); + } + } + return(0); +} + /* Convert a list of pmpkg_t * to a graph structure, * with a edge for each dependency. * Returns a list of vertices (one vertex = one package) @@ -192,7 +204,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse) return(newtargs); } -pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) +static pmpkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) { alpm_list_t *i; @@ -214,7 +226,7 @@ pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring) { pmdepend_t *dep = _alpm_splitdep(depstring); - pmpkg_t *pkg = _alpm_find_dep_satisfier(pkgs, dep); + pmpkg_t *pkg = find_dep_satisfier(pkgs, dep); _alpm_dep_free(dep); return(pkg); } @@ -257,15 +269,15 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps, pmdepend_t *depend = j->data; /* 1. we check the upgrade list */ /* 2. we check database for untouched satisfying packages */ - if(!_alpm_find_dep_satisfier(upgrade, depend) && - !_alpm_find_dep_satisfier(dblist, depend)) { + if(!find_dep_satisfier(upgrade, depend) && + !find_dep_satisfier(dblist, depend)) { /* Unsatisfied dependency in the upgrade list */ pmdepmissing_t *miss; char *missdepstring = alpm_dep_compute_string(depend); _alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n", missdepstring, alpm_pkg_get_name(tp)); free(missdepstring); - miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), depend, NULL); + miss = depmiss_new(alpm_pkg_get_name(tp), depend, NULL); baddeps = alpm_list_add(baddeps, miss); } } @@ -278,19 +290,19 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps, pmpkg_t *lp = i->data; for(j = alpm_pkg_get_depends(lp); j; j = j->next) { pmdepend_t *depend = j->data; - pmpkg_t *causingpkg = _alpm_find_dep_satisfier(modified, depend); + pmpkg_t *causingpkg = find_dep_satisfier(modified, depend); /* we won't break this depend, if it is already broken, we ignore it */ /* 1. check upgrade list for satisfiers */ /* 2. check dblist for satisfiers */ if(causingpkg && - !_alpm_find_dep_satisfier(upgrade, depend) && - !_alpm_find_dep_satisfier(dblist, depend)) { + !find_dep_satisfier(upgrade, depend) && + !find_dep_satisfier(dblist, depend)) { pmdepmissing_t *miss; char *missdepstring = alpm_dep_compute_string(depend); _alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n", missdepstring, alpm_pkg_get_name(lp)); free(missdepstring); - miss = _alpm_depmiss_new(lp->name, depend, alpm_pkg_get_name(causingpkg)); + miss = depmiss_new(lp->name, depend, alpm_pkg_get_name(causingpkg)); baddeps = alpm_list_add(baddeps, miss); } } @@ -538,7 +550,7 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit) * an error code without prompting * @return the resolved package **/ -pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, +static pmpkg_t *resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt) { alpm_list_t *i, *j; @@ -645,7 +657,7 @@ pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstri dep = _alpm_splitdep(depstring); ASSERT(dep, return(NULL)); - pkg = _alpm_resolvedep(dep, dbs, NULL, 1); + pkg = resolvedep(dep, dbs, NULL, 1); _alpm_dep_free(dep); return(pkg); } @@ -705,16 +717,16 @@ int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pk pmdepend_t *missdep = alpm_miss_get_dep(miss); /* check if one of the packages in the [*packages] list already satisfies * this dependency */ - if(_alpm_find_dep_satisfier(*packages, missdep)) { + if(find_dep_satisfier(*packages, missdep)) { _alpm_depmiss_free(miss); continue; } /* check if one of the packages in the [preferred] list already satisfies * this dependency */ - pmpkg_t *spkg = _alpm_find_dep_satisfier(preferred, missdep); + pmpkg_t *spkg = find_dep_satisfier(preferred, missdep); if(!spkg) { /* find a satisfier package in the given repositories */ - spkg = _alpm_resolvedep(missdep, dbs_sync, *packages, 0); + spkg = resolvedep(missdep, dbs_sync, *packages, 0); } if(!spkg) { pm_errno = PM_ERR_UNSATISFIED_DEPS; @@ -747,18 +759,6 @@ int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pk return(ret); } -/* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */ -int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2) -{ - alpm_list_t *i; - for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) { - if(_alpm_depcmp_tolerant(pkg2, i->data)) { - return(1); - } - } - return(0); -} - const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss) { ALPM_LOG_FUNC; diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h index 86070ab4..11ad2462 100644 --- a/lib/libalpm/deps.h +++ b/lib/libalpm/deps.h @@ -44,18 +44,13 @@ struct __pmdepmissing_t { void _alpm_dep_free(pmdepend_t *dep); pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep); -pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep, - const char *causinpkg); void _alpm_depmiss_free(pmdepmissing_t *miss); alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse); void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit); -pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt); int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove, alpm_list_t **data); -int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2); pmdepend_t *_alpm_splitdep(const char *depstring); -pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep); int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep); int _alpm_depcmp_tolerant(pmpkg_t *pkg, pmdepend_t *dep); |