diff options
author | Dan McGee <dan@archlinux.org> | 2008-02-16 03:57:30 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-02-16 18:58:49 +0100 |
commit | 92ab7c33fb4d72eba070636f620f595dc4650ee9 (patch) | |
tree | b2f70b7ee2b240868a8701e9a48fa3d778559378 /lib/libalpm/deps.c | |
parent | 6b07b5d34512ef361ebf04395f07965cb80d0ec3 (diff) | |
download | pacman-92ab7c33fb4d72eba070636f620f595dc4650ee9.tar.gz pacman-92ab7c33fb4d72eba070636f620f595dc4650ee9.tar.xz |
Move pmgraph_t struct and functions to their own header file
This will allow us to utilize this helpful type and functions in places
besides dependency calculations. In addition, remove the public declaration
of pmgraph_t in alpm.h- there is zero need to expose this internal type.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/deps.c')
-rw-r--r-- | lib/libalpm/deps.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index c08c59e9..29dafc29 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -31,6 +31,7 @@ #include "util.h" #include "log.h" #include "error.h" +#include "graph.h" #include "package.h" #include "db.h" #include "cache.h" @@ -43,31 +44,6 @@ void _alpm_dep_free(pmdepend_t *dep) FREE(dep); } -static pmgraph_t *_alpm_graph_new(void) -{ - pmgraph_t *graph = NULL; - - ALPM_LOG_FUNC; - - MALLOC(graph, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL)); - - if(graph) { - graph->state = 0; - graph->data = NULL; - graph->parent = NULL; - graph->children = NULL; - graph->childptr = NULL; - } - return(graph); -} - -static void _alpm_graph_free(void *data) -{ - pmgraph_t *graph = data; - alpm_list_free(graph->children); - free(graph); -} - pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep, const char *causingpkg) { @@ -97,7 +73,7 @@ void _alpm_depmiss_free(pmdepmissing_t *miss) * Returns a list of vertices (one vertex = one package) * (used by alpm_sortbydeps) */ -static alpm_list_t *_alpm_graph_init(alpm_list_t *targets) +static alpm_list_t *dep_graph_init(alpm_list_t *targets) { alpm_list_t *i, *j, *k; alpm_list_t *vertices = NULL; @@ -161,7 +137,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode) _alpm_log(PM_LOG_DEBUG, "started sorting dependencies\n"); - vertices = _alpm_graph_init(targets); + vertices = dep_graph_init(targets); vptr = vertices; vertex = vertices->data; |