[PPL-devel] [GIT] ppl/ppl(master): Prefer explicit tests against zero.

Enea Zaffanella zaffanella at cs.unipr.it
Sat Feb 25 11:33:41 CET 2012


Module: ppl/ppl
Branch: master
Commit: 1ea98773b74de31caebd07558ec8b215d8298c6b
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=1ea98773b74de31caebd07558ec8b215d8298c6b

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Sat Feb 25 11:33:08 2012 +0100

Prefer explicit tests against zero.
Detected by ECLAIR service utypflag.

---

 src/PIP_Problem.cc |    4 ++--
 src/PIP_Tree.cc    |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/PIP_Problem.cc b/src/PIP_Problem.cc
index 9c82202..6c52d69 100644
--- a/src/PIP_Problem.cc
+++ b/src/PIP_Problem.cc
@@ -232,10 +232,10 @@ PPL::PIP_Problem::solve() const {
                                                      external_space_dim,
                                                      /*indent_level=*/ 0);
       // Update problem status.
-      x.status = (x.current_solution) ? OPTIMIZED : UNSATISFIABLE;
+      x.status = (x.current_solution != 0) ? OPTIMIZED : UNSATISFIABLE;
 
       PPL_ASSERT(OK());
-      return (x.current_solution)
+      return (x.current_solution != 0)
         ? OPTIMIZED_PIP_PROBLEM
         : UNFEASIBLE_PIP_PROBLEM;
     } // End of handler for PARTIALLY_SATISFIABLE case.
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 76b5a0d..4f2e82e 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -3574,7 +3574,7 @@ PIP_Solution_Node::print_tree(std::ostream& s, const int indent,
 const Linear_Expression&
 PIP_Solution_Node::parametric_values(const Variable var) const {
   const PIP_Problem* pip = get_owner();
-  PPL_ASSERT(pip);
+  PPL_ASSERT(pip != 0);
 
   const dimension_type space_dim = pip->space_dimension();
   if (var.space_dimension() > space_dim) {
@@ -3613,7 +3613,7 @@ PIP_Solution_Node::update_solution() const {
     return;
 
   const PIP_Problem* pip = get_owner();
-  PPL_ASSERT(pip);
+  PPL_ASSERT(pip != 0);
   std::vector<bool> pip_dim_is_param(pip->space_dimension());
   const Variables_Set& params = pip->parameter_space_dimensions();
   for (Variables_Set::const_iterator p = params.begin(),




More information about the PPL-devel mailing list