graph.h: rename childptr -> iterator
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
parent
9c763a0d1b
commit
1550938ce1
3 changed files with 10 additions and 10 deletions
|
@ -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->children = alpm_list_add(v_i->children, v_j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
v_i->childptr = v_i->children;
|
v_i->iterator = v_i->children;
|
||||||
}
|
}
|
||||||
return vertices;
|
return vertices;
|
||||||
}
|
}
|
||||||
|
@ -144,16 +144,16 @@ static void dijkstra(alpm_list_t *vertices)
|
||||||
|
|
||||||
v->state = ALPM_GRAPH_STATE_PROCESSING;
|
v->state = ALPM_GRAPH_STATE_PROCESSING;
|
||||||
|
|
||||||
v->childptr = v->children;
|
v->iterator = v->children;
|
||||||
while(v->childptr) {
|
while(v->iterator) {
|
||||||
alpm_graph_t *v_c = v->childptr->data;
|
alpm_graph_t *v_c = v->iterator->data;
|
||||||
alpm_delta_t *d_c = v_c->data;
|
alpm_delta_t *d_c = v_c->data;
|
||||||
if(v_c->weight > v->weight + d_c->download_size) {
|
if(v_c->weight > v->weight + d_c->download_size) {
|
||||||
v_c->weight = v->weight + d_c->download_size;
|
v_c->weight = v->weight + d_c->download_size;
|
||||||
v_c->parent = v;
|
v_c->parent = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
v->childptr = (v->childptr)->next;
|
v->iterator = (v->iterator)->next;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ static alpm_list_t *dep_graph_init(alpm_handle_t *handle,
|
||||||
j = next;
|
j = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
vertex_i->childptr = vertex_i->children;
|
vertex_i->iterator = vertex_i->children;
|
||||||
}
|
}
|
||||||
alpm_list_free(localpkgs);
|
alpm_list_free(localpkgs);
|
||||||
return vertices;
|
return vertices;
|
||||||
|
@ -196,9 +196,9 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
|
||||||
/* mark that we touched the vertex */
|
/* mark that we touched the vertex */
|
||||||
vertex->state = ALPM_GRAPH_STATE_PROCESSING;
|
vertex->state = ALPM_GRAPH_STATE_PROCESSING;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
while(vertex->childptr && !found) {
|
while(vertex->iterator && !found) {
|
||||||
alpm_graph_t *nextchild = vertex->childptr->data;
|
alpm_graph_t *nextchild = vertex->iterator->data;
|
||||||
vertex->childptr = vertex->childptr->next;
|
vertex->iterator = vertex->iterator->next;
|
||||||
if(nextchild->state == ALPM_GRAPH_STATE_UNPROCESSED) {
|
if(nextchild->state == ALPM_GRAPH_STATE_UNPROCESSED) {
|
||||||
found = 1;
|
found = 1;
|
||||||
nextchild->parent = vertex;
|
nextchild->parent = vertex;
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct __alpm_graph_t {
|
||||||
void *data;
|
void *data;
|
||||||
struct __alpm_graph_t *parent; /* where did we come from? */
|
struct __alpm_graph_t *parent; /* where did we come from? */
|
||||||
alpm_list_t *children;
|
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 */
|
off_t weight; /* weight of the node */
|
||||||
enum __alpm_graph_vertex_state state;
|
enum __alpm_graph_vertex_state state;
|
||||||
} alpm_graph_t;
|
} alpm_graph_t;
|
||||||
|
|
Loading…
Add table
Reference in a new issue