[cairo] Bug in _cairo_hull_vertex_compare()

Andreas Falkenhahn andreas at airsoftsoftwair.de
Tue Apr 13 02:25:06 PDT 2010


Hi,

I noticed that the function _cairo_hull_vertex_compare() (a qsort() compare callback)
will never return 0 (= identity). This does not lead to any problems with the gcc
implementation of qsort() because that apparently doesn't run the compare callback on
identical elements. However, I've seen qsort() implementations (for example in the
vbcc compiler package) which may run the compare callback even on the same
elements. In that case, the _cairo_hull_vertex_compare() callback can often lead to a
deadlock because it never returns 0. 

Disclaimer: I know, it doesn't make much sense to run the compare callback on elements
which are obviously the same but ISO-C99's qsort() specifications don't explicitly forbid
this case, so IMHO the bug is in the _cairo_hull_vertex_compare() function and not
in the qsort() implementation of the vbcc compiler.

Comments on this very welcome :)

Greets,

Andreas
--
"Remember: It's nice to be important but it's more important to be nice!"




More information about the cairo mailing list