[geos-devel] Question about GEOSPolygonize_full_r

Sandro Santilli strk at keybit.net
Fri Jul 19 00:34:27 PDT 2013


On Thu, Jul 18, 2013 at 09:47:35PM -0600, Sean Gillies wrote:
> Hi all,
> 
> Shapely users have been asking me about access to GEOSPolygonize_full_r and
> I'm looking into it today. One thing I don't understand about the function
> (not being much of a C++ programmer anymore) is why the cuts, dangles, and
> invalid rings are only retrieved if the pointers passed in for them are not
> NULL?
> 
> http://trac.osgeo.org/geos/browser/tags/3.3.8/capi/geos_ts_c.cpp#L3077
> 
> Wouldn't it be better if the pointers *were* NULL since they are supposed
> to point to memory allocated by this function instead of bringing in data
> from the caller?

The pointer value (*cuts) can be null, the code doesn't even check for that.
But you pass a pointer to the pointer, so that the code can change the
pointer value.

--strk;


More information about the geos-devel mailing list