From 92ab7c33fb4d72eba070636f620f595dc4650ee9 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 15 Feb 2008 20:57:30 -0600 Subject: 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 --- lib/libalpm/deps.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'lib/libalpm/deps.c') 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; -- cgit v1.2.3-2-g168b