summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-06-28 06:54:19 +0200
committerAllan McRae <allan@archlinux.org>2011-06-28 15:28:24 +0200
commit57b9b19b103a5d48a7116adfd546a516e121329c (patch)
tree659b396cec02543842184771214ca5dbd94c3262 /lib/libalpm
parent08fc1db24c9d30f63c9ac858ab2cc50f64f8e38b (diff)
downloadpacman-57b9b19b103a5d48a7116adfd546a516e121329c.tar.gz
pacman-57b9b19b103a5d48a7116adfd546a516e121329c.tar.xz
Rename pmgraph_t to alpm_graph_t
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/delta.c22
-rw-r--r--lib/libalpm/deps.c10
-rw-r--r--lib/libalpm/graph.c8
-rw-r--r--lib/libalpm/graph.h8
4 files changed, 24 insertions, 24 deletions
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index c5770bfc..d2c2fe80 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -40,7 +40,7 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
alpm_list_t *vertices = NULL;
/* create the vertices */
for(i = deltas; i; i = i->next) {
- pmgraph_t *v = _alpm_graph_new();
+ alpm_graph_t *v = _alpm_graph_new();
if(!v) {
alpm_list_free(vertices);
return NULL;
@@ -54,11 +54,11 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
/* compute the edges */
for(i = vertices; i; i = i->next) {
- pmgraph_t *v_i = i->data;
+ alpm_graph_t *v_i = i->data;
alpm_delta_t *d_i = v_i->data;
/* loop a second time so we make all possible comparisons */
for(j = vertices; j; j = j->next) {
- pmgraph_t *v_j = j->data;
+ alpm_graph_t *v_j = j->data;
alpm_delta_t *d_j = v_j->data;
/* We want to create a delta tree like the following:
* 1_to_2
@@ -84,7 +84,7 @@ static void graph_init_size(alpm_handle_t *handle, alpm_list_t *vertices)
for(i = vertices; i; i = i->next) {
char *fpath, *md5sum;
- pmgraph_t *v = i->data;
+ alpm_graph_t *v = i->data;
alpm_delta_t *vdelta = v->data;
/* determine whether the delta file already exists */
@@ -109,12 +109,12 @@ static void graph_init_size(alpm_handle_t *handle, alpm_list_t *vertices)
static void dijkstra(alpm_list_t *vertices)
{
alpm_list_t *i;
- pmgraph_t *v;
+ alpm_graph_t *v;
while(1) {
v = NULL;
/* find the smallest vertice not visited yet */
for(i = vertices; i; i = i->next) {
- pmgraph_t *v_i = i->data;
+ alpm_graph_t *v_i = i->data;
if(v_i->state == -1) {
continue;
@@ -132,7 +132,7 @@ static void dijkstra(alpm_list_t *vertices)
v->childptr = v->children;
while(v->childptr) {
- pmgraph_t *v_c = v->childptr->data;
+ alpm_graph_t *v_c = v->childptr->data;
alpm_delta_t *d_c = v_c->data;
if(v_c->weight > v->weight + d_c->download_size) {
v_c->weight = v->weight + d_c->download_size;
@@ -148,12 +148,12 @@ static void dijkstra(alpm_list_t *vertices)
static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **path)
{
alpm_list_t *i;
- pmgraph_t *v = NULL;
+ alpm_graph_t *v = NULL;
off_t bestsize = 0;
alpm_list_t *rpath = NULL;
for(i = vertices; i; i = i->next) {
- pmgraph_t *v_i = i->data;
+ alpm_graph_t *v_i = i->data;
alpm_delta_t *d_i = v_i->data;
if(strcmp(d_i->to, to) == 0) {
@@ -222,7 +222,7 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
vertices = graph_init(deltas, 1);
for(i = vertices; i; i = i->next) {
- pmgraph_t *v = i->data;
+ alpm_graph_t *v = i->data;
alpm_delta_t *vdelta = v->data;
if(strcmp(vdelta->to, to) == 0)
{
@@ -231,7 +231,7 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
}
dijkstra(vertices);
for(i = vertices; i; i = i->next) {
- pmgraph_t *v = i->data;
+ alpm_graph_t *v = i->data;
alpm_delta_t *vdelta = v->data;
if(v->weight > quota) {
unused = alpm_list_add(unused, vdelta->delta);
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 2ec5451e..6ca79c34 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -89,18 +89,18 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets)
alpm_list_t *vertices = NULL;
/* We create the vertices */
for(i = targets; i; i = i->next) {
- pmgraph_t *vertex = _alpm_graph_new();
+ alpm_graph_t *vertex = _alpm_graph_new();
vertex->data = (void *)i->data;
vertices = alpm_list_add(vertices, vertex);
}
/* We compute the edges */
for(i = vertices; i; i = i->next) {
- pmgraph_t *vertex_i = i->data;
+ alpm_graph_t *vertex_i = i->data;
alpm_pkg_t *p_i = vertex_i->data;
/* TODO this should be somehow combined with alpm_checkdeps */
for(j = vertices; j; j = j->next) {
- pmgraph_t *vertex_j = j->data;
+ alpm_graph_t *vertex_j = j->data;
alpm_pkg_t *p_j = vertex_j->data;
if(_alpm_dep_edge(p_i, p_j)) {
vertex_i->children =
@@ -132,7 +132,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
alpm_list_t *newtargs = NULL;
alpm_list_t *vertices = NULL;
alpm_list_t *vptr;
- pmgraph_t *vertex;
+ alpm_graph_t *vertex;
if(targets == NULL) {
return NULL;
@@ -149,7 +149,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
vertex->state = -1;
int found = 0;
while(vertex->childptr && !found) {
- pmgraph_t *nextchild = vertex->childptr->data;
+ alpm_graph_t *nextchild = vertex->childptr->data;
vertex->childptr = vertex->childptr->next;
if(nextchild->state == 0) {
found = 1;
diff --git a/lib/libalpm/graph.c b/lib/libalpm/graph.c
index fc2c9e16..3a7f24b8 100644
--- a/lib/libalpm/graph.c
+++ b/lib/libalpm/graph.c
@@ -23,17 +23,17 @@
#include "util.h"
#include "log.h"
-pmgraph_t *_alpm_graph_new(void)
+alpm_graph_t *_alpm_graph_new(void)
{
- pmgraph_t *graph = NULL;
+ alpm_graph_t *graph = NULL;
- CALLOC(graph, 1, sizeof(pmgraph_t), return NULL);
+ CALLOC(graph, 1, sizeof(alpm_graph_t), return NULL);
return graph;
}
void _alpm_graph_free(void *data)
{
- pmgraph_t *graph = data;
+ alpm_graph_t *graph = data;
alpm_list_free(graph->children);
free(graph);
}
diff --git a/lib/libalpm/graph.h b/lib/libalpm/graph.h
index f76c6004..d4d134b5 100644
--- a/lib/libalpm/graph.h
+++ b/lib/libalpm/graph.h
@@ -25,16 +25,16 @@
#include "alpm_list.h"
-typedef struct __pmgraph_t {
+typedef struct __alpm_graph_t {
char state; /* 0: untouched, -1: entered, other: leaving time */
off_t weight; /* weight of the node */
void *data;
- struct __pmgraph_t *parent; /* where did we come from? */
+ struct __alpm_graph_t *parent; /* where did we come from? */
alpm_list_t *children;
alpm_list_t *childptr; /* points to a child in children list */
-} pmgraph_t;
+} alpm_graph_t;
-pmgraph_t *_alpm_graph_new(void);
+alpm_graph_t *_alpm_graph_new(void);
void _alpm_graph_free(void *data);
#endif /* _ALPM_GRAPH_H */