[postgis-devel] lwgeom_*_in_place()

Sandro Santilli strk at kbt.io
Wed Oct 4 00:43:13 PDT 2017


On Tue, Oct 03, 2017 at 12:28:54PM -0700, Paul Ramsey wrote:
> > On Oct 3, 2017, at 12:18 PM, Sandro Santilli <strk at kbt.io> wrote:
> >
> > I think taking a non-const LWGEOM pointer should be enough.
> > 
> > I'm not enthusiast about adding thos 9 characters to each
> > and every function.
> 
> Well, since we can’t to function over-loading, we’ll need to have *some* signature difference, have a shorter-yet-still-evocative suggestion?

We don't need both versions of all functions, theoretically
we could aim to have all in-place versions, delegating any
cloning to caller.

But when doing the copy internally would be faster
(say when no copy would happen if there's nothing to do?) 
how about adding a _rw for "read-write" ?

I see "_ro" and "_rw" already used in the codebase:

  extern int getPoint2d_p_ro(const POINTARRAY *pa, int n, POINT2D **point);
  extern int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point);

  extern LWPOINTITERATOR* lwpointiterator_create(const LWGEOM* g);
  extern LWPOINTITERATOR* lwpointiterator_create_rw(LWGEOM* g);

--strk;



More information about the postgis-devel mailing list