The compiler said about this code:
delaunay.c: In function ‘
addFace’:
delaunay.c:428:48: warning: cast between incompatible function types from
‘void (*)(GFace *, ninfo *)’ {aka ‘void (*)(struct <anonymous> *, struct
<anonymous> *)’} to ‘gint (*)(void *, void *)’ {aka ‘int (*)(void *,
void *)’} [-Wcast-function-type]
gts_face_foreach_neighbor ((GtsFace*)f, 0, (GtsFunc) addNeighbor, &ni);
^
Similar to the prior commit, this was relying on a coincident return value of 0
from the callback function.
int* neigh;
} ninfo;
-static void addNeighbor (GFace* f, ninfo* es)
-{
+static gint addNeighbor(void *face, void *ni) {
+ GFace *f = face;
+ ninfo *es = ni;
+
es->neigh[es->nneigh] = f->idx;
es->nneigh++;
+
+ return 0;
}
static void addFace (GFace* f, fstate* es)
ni.nneigh = 0;
ni.neigh = neigh;
- gts_face_foreach_neighbor ((GtsFace*)f, 0, (GtsFunc) addNeighbor, &ni);
+ gts_face_foreach_neighbor((GtsFace*)f, 0, addNeighbor, &ni);
for (i = ni.nneigh; i < 3; i++)
neigh[i] = -1;
}