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

git at osgeo.org git at osgeo.org
Tue Sep 17 19:05:02 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  d07995369d961ff0ef3bad854dc3bdc05a904e9d (commit)
      from  f48babc898d5d267ae686378e17ead3f2aa6e0c0 (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 d07995369d961ff0ef3bad854dc3bdc05a904e9d
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Sep 17 22:04:08 2019 -0400

    Avoid heap alloc in GeometryNoder::toGeometry

diff --git a/src/noding/GeometryNoder.cpp b/src/noding/GeometryNoder.cpp
index 8a4bf13..afba323 100644
--- a/src/noding/GeometryNoder.cpp
+++ b/src/noding/GeometryNoder.cpp
@@ -98,22 +98,19 @@ GeometryNoder::toGeometry(SegmentString::NonConstVect& nodedEdges)
     std::set< OrientedCoordinateArray > ocas;
 
     // Create a geometry out of the noded substrings.
-    std::vector< geom::Geometry* >* lines = new std::vector< geom::Geometry* >();
-    lines->reserve(nodedEdges.size());
+    std::vector<std::unique_ptr<geom::Geometry>> lines;
+    lines.reserve(nodedEdges.size());
     for(auto& ss :  nodedEdges) {
         const geom::CoordinateSequence* coords = ss->getCoordinates();
 
         // Check if an equivalent edge is known
         OrientedCoordinateArray oca1(*coords);
         if(ocas.insert(oca1).second) {
-            geom::Geometry* tmp = geomFact->createLineString(coords->clone().release());
-            lines->push_back(tmp);
+            lines.push_back(geomFact->createLineString(coords->clone()));
         }
     }
 
-    std::unique_ptr<geom::Geometry> noded(geomFact->createMultiLineString(lines));
-
-    return noded;
+    return geomFact->createMultiLineString(std::move(lines));
 }
 
 /* public */

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

Summary of changes:
 src/noding/GeometryNoder.cpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list