commit du bug rebelle
This commit is contained in:
24
edges.c
24
edges.c
@@ -70,28 +70,36 @@ return 0;
|
||||
*/
|
||||
static int is_edge_in_list(EdgeList *list, int p0, int p1)
|
||||
{
|
||||
int idx;
|
||||
int idx, retval, place;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d %d )\n", __func__, list, p0, p1);
|
||||
#endif
|
||||
|
||||
retval = 0; place = -1;
|
||||
|
||||
for (idx=0; idx < list->fidx; idx++) {
|
||||
if ( (list->edges[idx].A == p0) &&
|
||||
(list->edges[idx].B == p1) ) return 1;
|
||||
(list->edges[idx].B == p1) ) {
|
||||
retval = 1; place = idx; break; }
|
||||
|
||||
if ( (list->edges[idx].A == p1) &&
|
||||
(list->edges[idx].B == p0) ) return 2;
|
||||
(list->edges[idx].B == p0) ){
|
||||
retval = 2; place = idx; break; }
|
||||
}
|
||||
|
||||
return 0; /* NOT FOUND */
|
||||
if (retval) fprintf(stderr, " edge %d %d found at %d\n", p0, p1, idx);
|
||||
|
||||
return retval;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
*
|
||||
* we have two functions for adding an edge to a list
|
||||
* the first one add unconditionnaly the edge to the
|
||||
* (non full) list...
|
||||
*/
|
||||
int push_an_edge(EdgeList *list, int p0, int p1)
|
||||
{
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d %d )\n", __func__, list, p0, p1);
|
||||
#endif
|
||||
@@ -130,8 +138,12 @@ if (list->fidx >= list->size) {
|
||||
if ( ! is_edge_in_list(list, p0, p1) ) {
|
||||
list->edges[list->fidx].A = p0;
|
||||
list->edges[list->fidx].B = p1;
|
||||
fprintf(stderr, "edge %d %d poked at %d\n", p0, p1, list->fidx);
|
||||
list->fidx ++;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, " %s: drop edge %d %d\n", __func__, p0, p1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user