summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2017-04-15 14:33:50 -0400
committerAndrew Gregory <andrew.gregory.8@gmail.com>2017-04-16 08:29:54 -0400
commit1550938ce1a081c4edc058b55ee34b320b849299 (patch)
tree7f897805322cbb2262d85475d154e7b2fb7d8ef3
parent9c763a0d1ba8aa56b1ff54cd8d137c6b73e19f11 (diff)
downloadpacman-1550938ce1a081c4edc058b55ee34b320b849299.tar.xz
graph.h: rename childptr -> iterator
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
-rw-r--r--lib/libalpm/delta.c10
-rw-r--r--lib/libalpm/deps.c8
-rw-r--r--lib/libalpm/graph.h2
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 58b1b41e..89bc32ff 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -71,7 +71,7 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
v_i->children = alpm_list_add(v_i->children, v_j);
}
}
- v_i->childptr = v_i->children;
+ v_i->iterator = v_i->children;
}
return vertices;
}
@@ -144,16 +144,16 @@ static void dijkstra(alpm_list_t *vertices)
v->state = ALPM_GRAPH_STATE_PROCESSING;
- v->childptr = v->children;
- while(v->childptr) {
- alpm_graph_t *v_c = v->childptr->data;
+ v->iterator = v->children;
+ while(v->iterator) {
+ alpm_graph_t *v_c = v->iterator->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;
v_c->parent = v;
}
- v->childptr = (v->childptr)->next;
+ v->iterator = (v->iterator)->next;
}
}
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index e5527d6c..6f05f0d0 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -152,7 +152,7 @@ static alpm_list_t *dep_graph_init(alpm_handle_t *handle,
j = next;
}
- vertex_i->childptr = vertex_i->children;
+ vertex_i->iterator = vertex_i->children;
}
alpm_list_free(localpkgs);
return vertices;
@@ -196,9 +196,9 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
/* mark that we touched the vertex */
vertex->state = ALPM_GRAPH_STATE_PROCESSING;
int found = 0;
- while(vertex->childptr && !found) {
- alpm_graph_t *nextchild = vertex->childptr->data;
- vertex->childptr = vertex->childptr->next;
+ while(vertex->iterator && !found) {
+ alpm_graph_t *nextchild = vertex->iterator->data;
+ vertex->iterator = vertex->iterator->next;
if(nextchild->state == ALPM_GRAPH_STATE_UNPROCESSED) {
found = 1;
nextchild->parent = vertex;
diff --git a/lib/libalpm/graph.h b/lib/libalpm/graph.h
index 233862b9..75cec937 100644
--- a/lib/libalpm/graph.h
+++ b/lib/libalpm/graph.h
@@ -33,7 +33,7 @@ typedef struct __alpm_graph_t {
void *data;
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 */
+ alpm_list_t *iterator; /* used for DFS without recursion */
off_t weight; /* weight of the node */
enum __alpm_graph_vertex_state state;
} alpm_graph_t;