[mlpack-git] master: Remove unnecessary checks for NULL. (7a77a14)

gitdub at mlpack.org gitdub at mlpack.org
Thu Feb 25 17:44:15 EST 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/a215b1b5577c42549dcbcf6dd0646f7b070647fc...7a77a1468425fefb53f2f62b3ccbb8edad5a94da

>---------------------------------------------------------------

commit 7a77a1468425fefb53f2f62b3ccbb8edad5a94da
Author: Ryan Curtin <ryan at ratml.org>
Date:   Thu Feb 25 17:43:56 2016 -0500

    Remove unnecessary checks for NULL.


>---------------------------------------------------------------

7a77a1468425fefb53f2f62b3ccbb8edad5a94da
 src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp | 6 ++----
 src/mlpack/methods/det/dtree.cpp                                  | 7 ++-----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
index 492373e..6f7bbb4 100644
--- a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
@@ -445,10 +445,8 @@ template<typename MetricType,
 BinarySpaceTree<MetricType, StatisticType, MatType, BoundType, SplitType>::
   ~BinarySpaceTree()
 {
-  if (left)
-    delete left;
-  if (right)
-    delete right;
+  delete left;
+  delete right;
 
   // If we're the root, delete the matrix.
   if (!parent)
diff --git a/src/mlpack/methods/det/dtree.cpp b/src/mlpack/methods/det/dtree.cpp
index 44e0f68..c88d480 100644
--- a/src/mlpack/methods/det/dtree.cpp
+++ b/src/mlpack/methods/det/dtree.cpp
@@ -136,11 +136,8 @@ DTree::DTree(const arma::vec& maxVals,
 
 DTree::~DTree()
 {
-  if (left != NULL)
-    delete left;
-
-  if (right != NULL)
-    delete right;
+  delete left;
+  delete right;
 }
 
 // This function computes the log-l2-negative-error of a given node from the




More information about the mlpack-git mailing list