]> granicus.if.org Git - postgis/commitdiff
Rename ptarray_clone to ptarray_clone_deep, to be conformant with lwgeom_clone_deep...
authorSandro Santilli <strk@keybit.net>
Wed, 6 Jul 2011 09:40:38 +0000 (09:40 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 6 Jul 2011 09:40:38 +0000 (09:40 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7605 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/liblwgeom.h
liblwgeom/libtgeom.c
liblwgeom/lwline.c
liblwgeom/lwpoly.c
liblwgeom/lwsegmentize.c
liblwgeom/lwtriangle.c
liblwgeom/ptarray.c
postgis/lwgeom_dump.c
postgis/lwgeom_functions_basic.c
postgis/lwgeom_in_gml.c
postgis/lwgeom_in_kml.c

index 253854a43b097ec22d143f1ff6bc31b46783317b..374e25dd12c9f2fabff454ffbeaccc4ed6b19b1e 100644 (file)
@@ -1688,7 +1688,7 @@ LWTRIANGLE *lwtriangle_clone(const LWTRIANGLE *lwgeom);
 LWCOLLECTION *lwcollection_clone(const LWCOLLECTION *lwgeom);
 LWCIRCSTRING *lwcircstring_clone(const LWCIRCSTRING *curve);
 BOX2DFLOAT4 *box2d_clone(const BOX2DFLOAT4 *lwgeom);
-POINTARRAY *ptarray_clone(const POINTARRAY *ptarray);
+POINTARRAY *ptarray_clone_deep(const POINTARRAY *ptarray);
 LWLINE *lwline_clone_deep(const LWLINE *lwgeom);
 LWPOLY *lwpoly_clone_deep(const LWPOLY *lwgeom);
 LWCOLLECTION *lwcollection_clone_deep(const LWCOLLECTION *lwgeom);
index 3acb5fa937c5f4edef10125ae0ccfe0b23c4ed84..0f33f4549eba01ce97138639c1f508a7eb66e720 100644 (file)
@@ -272,7 +272,7 @@ tgeom_add_polygon(TGEOM *tgeom, LWPOLY *poly)
        /* clone internal rings */
        for (i=0 ; i < tgeom->faces[tgeom->nfaces]->nrings ; i++)
                tgeom->faces[tgeom->nfaces]->rings[i]
-               = ptarray_clone(poly->rings[i+1]);
+               = ptarray_clone_deep(poly->rings[i+1]);
 
        tgeom->nfaces++;
 
index e6dc2b2fab20bef3c44e1a0dd6380c827d47b72a..4bc70dfc33e72e808888be2acf0fbefdef7054df 100644 (file)
@@ -353,7 +353,7 @@ lwline_clone_deep(const LWLINE *g)
        memcpy(ret, g, sizeof(LWLINE));
 
        if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
-       if ( g->points ) ret->points = ptarray_clone(g->points);
+       if ( g->points ) ret->points = ptarray_clone_deep(g->points);
        FLAGS_SET_READONLY(ret->flags,0);
 
        return ret;
index be6063ab0a5f26dbaaae0506a6b6b83760c74cd0..abaebdbb48bad789740a968b76328cd9b371ba85 100644 (file)
@@ -469,7 +469,7 @@ lwpoly_clone_deep(const LWPOLY *g)
        ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
        for ( i = 0; i < ret->nrings; i++ )
        {
-               ret->rings[i] = ptarray_clone(g->rings[i]);
+               ret->rings[i] = ptarray_clone_deep(g->rings[i]);
        }
        FLAGS_SET_READONLY(ret->flags,0);
        return ret;
@@ -586,7 +586,7 @@ lwpoly_from_lwlines(const LWLINE *shell,
                lwerror("lwpoly_from_lwlines: shell must have at least 4 points");
        if ( ! ptarray_isclosed2d(shell->points) )
                lwerror("lwpoly_from_lwlines: shell must be closed");
-       rings[0] = ptarray_clone(shell->points);
+       rings[0] = ptarray_clone_deep(shell->points);
 
        for (nrings=1; nrings<=nholes; nrings++)
        {
@@ -600,7 +600,7 @@ lwpoly_from_lwlines(const LWLINE *shell,
                if ( ! ptarray_isclosed2d(hole->points) )
                        lwerror("lwpoly_from_lwlines: holes must be closed");
 
-               rings[nrings] = ptarray_clone(hole->points);
+               rings[nrings] = ptarray_clone_deep(hole->points);
        }
 
        ret = lwpoly_construct(srid, NULL, nrings, rings);
index 9592e5b481fcd51273b009493cd81fc8ee7946d0..913425d35ede205ef208c0e96eb1d95113d8d887 100644 (file)
@@ -356,18 +356,18 @@ lwcurvepoly_segmentize(const LWCURVEPOLY *curvepoly, uint32 perQuad)
                if (tmp->type == CIRCSTRINGTYPE)
                {
                        line = lwcircstring_segmentize((LWCIRCSTRING *)tmp, perQuad);
-                       ptarray[i] = ptarray_clone(line->points);
+                       ptarray[i] = ptarray_clone_deep(line->points);
                        lwfree(line);
                }
                else if (tmp->type == LINETYPE)
                {
                        line = (LWLINE *)tmp;
-                       ptarray[i] = ptarray_clone(line->points);
+                       ptarray[i] = ptarray_clone_deep(line->points);
                }
                else if (tmp->type == COMPOUNDTYPE)
                {
                        line = lwcompound_segmentize((LWCOMPOUND *)tmp, perQuad);
-                       ptarray[i] = ptarray_clone(line->points);
+                       ptarray[i] = ptarray_clone_deep(line->points);
                        lwfree(line);
                }
                else
@@ -402,7 +402,7 @@ lwmcurve_segmentize(LWMCURVE *mcurve, uint32 perQuad)
                }
                else if (tmp->type == LINETYPE)
                {
-                       lines[i] = (LWGEOM *)lwline_construct(mcurve->srid, NULL, ptarray_clone(((LWLINE *)tmp)->points));
+                       lines[i] = (LWGEOM *)lwline_construct(mcurve->srid, NULL, ptarray_clone_deep(((LWLINE *)tmp)->points));
                }
                else
                {
@@ -442,7 +442,7 @@ lwmsurface_segmentize(LWMSURFACE *msurface, uint32 perQuad)
                        ptarray = lwalloc(sizeof(POINTARRAY *)*poly->nrings);
                        for (j = 0; j < poly->nrings; j++)
                        {
-                               ptarray[j] = ptarray_clone(poly->rings[j]);
+                               ptarray[j] = ptarray_clone_deep(poly->rings[j]);
                        }
                        polys[i] = (LWGEOM *)lwpoly_construct(msurface->srid, NULL, poly->nrings, ptarray);
                }
index 0593fae78fff4861cbffc40a113d00967f352812..6e48dc358feeafbc96e934d5ae60d374bc679512 100644 (file)
@@ -396,7 +396,7 @@ lwtriangle_from_lwline(const LWLINE *shell)
                (FLAGS_GET_Z(shell->flags) && !ptarray_isclosed3d(shell->points)) )
                lwerror("lwtriangle_from_lwline: shell must be closed");
 
-       pa = ptarray_clone(shell->points);
+       pa = ptarray_clone_deep(shell->points);
        ret = lwtriangle_construct(shell->srid, NULL, pa);
 
        if (lwtriangle_is_repeated_points(ret))
index f878d173b1c99b1fc011d6a860b471a910a2f8a2..c6df1e3dc18d109eaae3b4e269c90aa9d7f7bf21 100644 (file)
@@ -615,12 +615,12 @@ ptarray_merge(POINTARRAY *pa1, POINTARRAY *pa2)
  * @brief Clone a pointarray
  */
 POINTARRAY *
-ptarray_clone(const POINTARRAY *in)
+ptarray_clone_deep(const POINTARRAY *in)
 {
        POINTARRAY *out = lwalloc(sizeof(POINTARRAY));
        size_t size;
 
-       LWDEBUG(3, "ptarray_clone called.");
+       LWDEBUG(3, "ptarray_clone_deep called.");
 
        out->flags = in->flags;
        out->npoints = in->npoints;
@@ -1122,7 +1122,7 @@ ptarray_remove_repeated_points(POINTARRAY *in)
        LWDEBUG(3, "ptarray_remove_repeated_points called.");
 
        /* Single or zero point arrays can't have duplicates */
-       if ( in->npoints < 3 ) return ptarray_clone(in);
+       if ( in->npoints < 3 ) return ptarray_clone_deep(in);
 
        ptsize = ptarray_point_size(in);
 
index f047135b997c301fefc4e104ce17407f170428e4..201484f9ab6cce97cf296cf48ad908b2db0c9d5b 100644 (file)
@@ -274,7 +274,7 @@ Datum LWGEOM_dump_rings(PG_FUNCTION_ARGS)
                oldcontext = MemoryContextSwitchTo(newcontext);
 
                /* We need a copy of input ring here */
-               ring = ptarray_clone(poly->rings[state->ringnum]);
+               ring = ptarray_clone_deep(poly->rings[state->ringnum]);
 
                /* Construct another polygon with shell only */
                ringgeom = (LWGEOM*)lwpoly_construct(
index 796389bf875b275b1e38812e3a615a6d9bdef807..23a9a2ceec85ed7a75f99993af2a6f4bca149f9d 100644 (file)
@@ -1818,7 +1818,7 @@ Datum LWGEOM_segmentize2d(PG_FUNCTION_ARGS)
 
        outgeom = pglwgeom_serialize(outlwgeom);
 
-       //lwgeom_free(outlwgeom); /* TODO fix lwgeom_clone / ptarray_clone for consistent semantics */
+       //lwgeom_free(outlwgeom); /* TODO fix lwgeom_clone / ptarray_clone_deep for consistent semantics */
        lwgeom_free(inlwgeom);
        
        PG_FREE_IF_COPY(ingeom, 0);
index 4a629d73eabffc5f2afb333eda853a96389c5b24..ae2494422f8e5649cc71e5914d7c17071173fbaa 100644 (file)
@@ -652,7 +652,7 @@ static POINTARRAY* parse_gml_coordinates(xmlNodePtr xnode, bool *hasz)
 
        /* TODO: this makes no sense, we shouldn't have to clone. but we're seeing 
           memory problems when we don't. */
-       return ptarray_clone(dpa);
+       return ptarray_clone_deep(dpa);
 }
 
 
@@ -708,7 +708,7 @@ static POINTARRAY* parse_gml_coord(xmlNodePtr xnode, bool *hasz)
        ptarray_append_point(dpa, &p, REPEATED_POINTS_NOT_OK);
        x = y = z = false;
 
-       return ptarray_clone(dpa);
+       return ptarray_clone_deep(dpa);
 }
 
 
@@ -784,7 +784,7 @@ static POINTARRAY* parse_gml_pos(xmlNodePtr xnode, bool *hasz)
                ptarray_append_point(dpa, &pt, REPEATED_POINTS_NOT_OK);
        }
 
-       return ptarray_clone(dpa);
+       return ptarray_clone_deep(dpa);
 }
 
 
@@ -851,7 +851,7 @@ static POINTARRAY* parse_gml_poslist(xmlNodePtr xnode, bool *hasz)
 
        xmlFree(gmlposlist);
 
-       return ptarray_clone(dpa);
+       return ptarray_clone_deep(dpa);
 }
 
 
index 5952c4f7ca463a4021bdccda4a6ba1e158857314..07c52a5f8a0cbae406158e02a707c82f251bd008 100644 (file)
@@ -333,7 +333,7 @@ static POINTARRAY* parse_kml_coordinates(xmlNodePtr xnode, bool *hasz)
        xmlFree(kml_coord);
 
        /* TODO: we shouldn't need to clone here */
-       return ptarray_clone(dpa);
+       return ptarray_clone_deep(dpa);
 }