]> sourceware.org Git - libabigail.git/commitdiff
Cleanup functions to detect infinite comparison of class_decl
authorDodji Seketeli <dodji@redhat.com>
Fri, 7 Oct 2016 13:46:02 +0000 (15:46 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 10 Oct 2016 10:57:25 +0000 (12:57 +0200)
While looking around, I found some things in need of a cleanup.  This
patch addresses those.

* src/abg-ir.cc (class_decl::priv::unmark_as_being_compared): In
the overload that takes a pointer to class_decl, re-use the
overload that takes a reference.
(class_decl::priv::comparison_started): Do not crash if the klass
pointer is nil.
(equals): In the overload for class_decl&, undef the RESULT macro
when it's not used anymore.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-ir.cc

index 4fec0184287e44447d26008a0bc1fd19f57db3f2..11a632bc8a9e5ff7cc78a76f93333c58e18ab4e3 100644 (file)
@@ -12302,9 +12302,8 @@ struct class_decl::priv
   void
   unmark_as_being_compared(const class_decl* klass) const
   {
-    const environment* env = klass->get_environment();
-    assert(env);
-    env->priv_->classes_being_compared_.erase(klass->get_qualified_name());
+    if (klass)
+      return unmark_as_being_compared(*klass);
   }
 
   /// Test if a given instance of class_decl is being currently
@@ -12330,7 +12329,11 @@ struct class_decl::priv
   /// @return true if @p klass is being compared, false otherwise.
   bool
   comparison_started(const class_decl* klass) const
-  {return comparison_started(*klass);}
+  {
+    if (klass)
+      return comparison_started(*klass);
+    return false;
+  }
 };// end struct class_decl::priv
 
 /// A Constructor for instances of \ref class_decl
@@ -13814,6 +13817,7 @@ equals(const class_decl& l, const class_decl& r, change_kind* k)
   }
 
   RETURN(result);
+#undef RETURN
 }
 
 /// Comparison operator for @ref class_decl.
This page took 0.046515 seconds and 5 git commands to generate.