[geos-commits] [SCM] GEOS branch master updated. f48babc898d5d267ae686378e17ead3f2aa6e0c0

git at osgeo.org git at osgeo.org
Tue Sep 17 19:02:20 PDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  f48babc898d5d267ae686378e17ead3f2aa6e0c0 (commit)
       via  23c813df93de8b75282b5e3e28df4b2097bab776 (commit)
      from  ee32879243b320fab802d44f30f96ea90f00bcb2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f48babc898d5d267ae686378e17ead3f2aa6e0c0
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Sep 17 22:01:12 2019 -0400

    Avoid heap alloc in GeometryCollection::reverse

diff --git a/src/geom/GeometryCollection.cpp b/src/geom/GeometryCollection.cpp
index 3e18fc5..9751be0 100644
--- a/src/geom/GeometryCollection.cpp
+++ b/src/geom/GeometryCollection.cpp
@@ -387,16 +387,16 @@ GeometryCollection::reverse() const
         return clone();
     }
 
-    auto* reversed = new std::vector<Geometry*> {geometries.size()};
+    std::vector<std::unique_ptr<Geometry>> reversed(geometries.size());
 
     std::transform(geometries.begin(),
                    geometries.end(),
-                   reversed->begin(),
+                   reversed.begin(),
     [](const std::unique_ptr<Geometry> & g) {
-        return g->reverse().release();
+        return g->reverse();
     });
 
-    return std::unique_ptr<Geometry>(getFactory()->createGeometryCollection(reversed));
+    return getFactory()->createGeometryCollection(std::move(reversed));
 }
 
 } // namespace geos::geom

commit 23c813df93de8b75282b5e3e28df4b2097bab776
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Sep 17 22:00:12 2019 -0400

    Use empty geom constructor in getBoundary methods

diff --git a/src/geom/MultiLineString.cpp b/src/geom/MultiLineString.cpp
index 42bf4dc..2226dc0 100644
--- a/src/geom/MultiLineString.cpp
+++ b/src/geom/MultiLineString.cpp
@@ -99,7 +99,7 @@ std::unique_ptr<Geometry>
 MultiLineString::getBoundary() const
 {
     if(isEmpty()) {
-        return std::unique_ptr<Geometry>(getFactory()->createGeometryCollection(nullptr));
+        return getFactory()->createGeometryCollection();
     }
 
     GeometryGraph gg(0, this);
diff --git a/src/geom/Point.cpp b/src/geom/Point.cpp
index 325ec2a..921073e 100644
--- a/src/geom/Point.cpp
+++ b/src/geom/Point.cpp
@@ -164,7 +164,7 @@ Point::getGeometryType() const
 std::unique_ptr<Geometry>
 Point::getBoundary() const
 {
-    return std::unique_ptr<Geometry>(getFactory()->createGeometryCollection(nullptr));
+    return getFactory()->createGeometryCollection();
 }
 
 Envelope::Ptr

-----------------------------------------------------------------------

Summary of changes:
 src/geom/GeometryCollection.cpp | 8 ++++----
 src/geom/MultiLineString.cpp    | 2 +-
 src/geom/Point.cpp              | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list