[Cmake-commits] CMake branch, next, updated. v2.8.9-514-g3e6830f

Stephen Kelly steveire at gmail.com
Thu Sep 13 11:55:49 EDT 2012


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 "CMake".

The branch, next has been updated
       via  3e6830fb153571300ccd9e025d08ecfd25d7b5d7 (commit)
       via  3c35a4d24c281e071bce5813bba1020195757fe5 (commit)
      from  4e2baa83cff83c51e589596d8cbb76179ed55d03 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e6830fb153571300ccd9e025d08ecfd25d7b5d7
commit 3e6830fb153571300ccd9e025d08ecfd25d7b5d7
Merge: 4e2baa8 3c35a4d
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Sep 13 11:55:40 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Sep 13 11:55:40 2012 -0400

    Merge topic 'generator-expression-refactor' into next
    
    3c35a4d Delete sub-evaluators on destruction.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c35a4d24c281e071bce5813bba1020195757fe5
commit 3c35a4d24c281e071bce5813bba1020195757fe5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Sep 13 17:53:19 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Sep 13 17:54:20 2012 +0200

    Delete sub-evaluators on destruction.
    
    Valgrind showed some memory leaks.

diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 0d1e1db..7add406 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -462,3 +462,33 @@ std::string GeneratorExpressionContent::Evaluate(
 
   return node->Evaluate(parameters, context, this);
 }
+
+//----------------------------------------------------------------------------
+static void deleteAll(const std::vector<cmGeneratorExpressionEvaluator*> &container)
+{
+  std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
+                                                  = container.begin();
+  const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
+                                                  = container.end();
+  for ( ; it != end; ++it)
+    {
+    delete *it;
+    }
+}
+
+//----------------------------------------------------------------------------
+GeneratorExpressionContent::~GeneratorExpressionContent()
+{
+  deleteAll(this->IdentifierChildren);
+
+  typedef std::vector<cmGeneratorExpressionEvaluator*> EvaluatorVector;
+  typedef std::vector<cmGeneratorExpressionToken> TokenVector;
+  std::vector<EvaluatorVector>::const_iterator pit =
+                                                  this->ParamChildren.begin();
+  const std::vector<EvaluatorVector>::const_iterator pend =
+                                                  this->ParamChildren.end();
+  for ( ; pit != pend; ++pit)
+    {
+    deleteAll(*pit);
+    }
+}
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index bf35778..af4e8c5 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -101,6 +101,8 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
 
   std::string GetOriginalExpression() const;
 
+  ~GeneratorExpressionContent();
+
 private:
   std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren;
   std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren;

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

Summary of changes:
 Source/cmGeneratorExpressionEvaluator.cxx |   30 +++++++++++++++++++++++++++++
 Source/cmGeneratorExpressionEvaluator.h   |    2 +
 2 files changed, 32 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list