The compiler said about this code:
delaunay.c: In function ‘edgeStats’:
delaunay.c:245:34: warning: cast between incompatible function types from
‘void (*)(GtsSegment *, estats *)’ {aka ‘void (*)(struct _GtsSegment *,
struct <anonymous> *)’} to ‘gint (*)(void *, void *)’ {aka
‘int (*)(void *, void *)’} [-Wcast-function-type]
gts_surface_foreach_edge (s, (GtsFunc) cnt_edge, sp);
^
This is not quite as bad as the previous instance of this fixed. However, it
seems to have been relying on a coincident return value. E.g. on x86-64 this
code relies on 0 ending up in `RAX` at the end of the callback to indicate
iteration should continue, despite `cnt_edge` having no declared return value.
- remove Bashism from `gvmap.sh` #2151
- Lefty artifacts are no longer installed when Lefty is disabled #2153
- Smyrna artifacts are no longer installed when Smyrna is disabled
-- calling convention mismatch in delaunay.c’s GTS code
+- calling convention mismatches in delaunay.c’s GTS code
## [2.49.3] – 2021-10-22
v_data *delaunay;
} estats;
-static void cnt_edge (GtsSegment * e, estats* sp)
-{
+static gint cnt_edge(void *edge, void *stats) {
+ GtsSegment *e = edge;
+ estats *sp = stats;
+
sp->n++;
if (sp->delaunay) {
sp->delaunay[((GVertex*)(e->v1))->idx].nedges++;
sp->delaunay[((GVertex*)(e->v2))->idx].nedges++;
}
+
+ return 0;
}
static void
edgeStats (GtsSurface* s, estats* sp)
{
- gts_surface_foreach_edge (s, (GtsFunc) cnt_edge, sp);
+ gts_surface_foreach_edge(s, cnt_edge, sp);
}
static void add_edge (GtsSegment * e, v_data* delaunay)