[postgis-devel] lwgeom_*_in_place()

Paul Ramsey pramsey at cleverelephant.ca
Wed Oct 4 06:27:21 PDT 2017

> On Oct 4, 2017, at 12:43 AM, Sandro Santilli <strk at kbt.io> wrote:
> 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 don’t understand the caveat “when doing the copy internally would be faster”. 
I’ve started on creating in_place variants, now, I’m tempted to just commit them 
as they come, and since they have nice big signatures we can re-name them 
as we wish with a simple search/replace.

(The patch is getting larger and larger, so the sooner I land it, the better…)


> 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;
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel

More information about the postgis-devel mailing list