[geos-commits] [SCM] GEOS branch master updated. 38efd9bd7c5a778983f4ce3d8c557e9d85a76b77

git at osgeo.org git at osgeo.org
Wed Sep 4 19:07:53 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  38efd9bd7c5a778983f4ce3d8c557e9d85a76b77 (commit)
      from  b39c039d89c67c7635f0e61be873f3c2ab3d2f96 (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 38efd9bd7c5a778983f4ce3d8c557e9d85a76b77
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Sep 4 22:07:44 2019 -0400

    Use unique_ptr in MonotoneChain

diff --git a/include/geos/index/chain/MonotoneChain.h b/include/geos/index/chain/MonotoneChain.h
index 608c3dd..13323af 100644
--- a/include/geos/index/chain/MonotoneChain.h
+++ b/include/geos/index/chain/MonotoneChain.h
@@ -173,7 +173,7 @@ private:
     const geom::CoordinateSequence& pts;
 
     /// Owned by this class, lazely created
-    mutable geom::Envelope* env;
+    mutable std::unique_ptr<geom::Envelope> env;
 
     /// user-defined information
     void* context;
diff --git a/src/index/chain/MonotoneChain.cpp b/src/index/chain/MonotoneChain.cpp
index 795b3bc..8f2e13c 100644
--- a/src/index/chain/MonotoneChain.cpp
+++ b/src/index/chain/MonotoneChain.cpp
@@ -23,6 +23,7 @@
 #include <geos/geom/CoordinateSequence.h>
 #include <geos/geom/LineSegment.h>
 #include <geos/geom/Envelope.h>
+#include <geos/util.h>
 
 using namespace geos::geom;
 
@@ -42,10 +43,7 @@ MonotoneChain::MonotoneChain(const geom::CoordinateSequence& newPts,
 {
 }
 
-MonotoneChain::~MonotoneChain()
-{
-    delete env;
-}
+MonotoneChain::~MonotoneChain() = default;
 
 const Envelope&
 MonotoneChain::getEnvelope() const
@@ -53,7 +51,7 @@ MonotoneChain::getEnvelope() const
     if(nullptr == env) {
         const Coordinate& p0 = pts[start];
         const Coordinate& p1 = pts[end];
-        env = new Envelope(p0, p1);
+        env = detail::make_unique<Envelope>(p0, p1);
     }
     return *env;
 }

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

Summary of changes:
 include/geos/index/chain/MonotoneChain.h | 2 +-
 src/index/chain/MonotoneChain.cpp        | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list