void *data;
};
-struct edge2 {
- struct node *from;
- struct node *to;
-};
-
int ptrcmp(const void *l, const void *r)
{
return ((ptrdiff_t)((struct node *)l)->data)
}
struct components *strongconnect(struct node *v, struct node **stack, int *sp,
- int *index, int nedges, struct edge2 *edges, struct components *components)
+ int *index, int nedges, struct edge *edges, struct components *components)
{
struct node *w;
v->index = *index;
.onStack=false, .data=nodedata[i]};
qsort(nodes, nnodes, sizeof(struct node), ptrcmp);
- struct edge2 *edges = safe_malloc(nedges*sizeof(struct edge2));
+ struct edge *edges = safe_malloc(nedges*sizeof(struct edge));
for (int i = 0; i<nedges; i++) {
struct node *from = bsearch(edgedata[i].from, nodes, nnodes,
sizeof(struct node), nodecmp);
fprintf(stderr, "edge to references unknown node\n");
goto end;
}
- edges[i] = (struct edge2){.from=from, .to=to};
+ edges[i] = (struct edge){.from=from, .to=to};
}
struct node **stack = safe_malloc(nnodes*sizeof(struct node *));