[nemiver/varobjs-support] Add == operator for pointers to SafePtr



commit 2f183cecebb21fb555eae81f2c8464b1d2d6002f
Author: Dodji Seketeli <dodji redhat com>
Date:   Sat Apr 18 19:10:59 2009 +0200

    Add == operator for pointers to SafePtr
    
    	* src/common/nmv-safe-ptr.h: Add equality operator against
    	  pointers.
    	* src/dbgengine/nmv-i-debugger.h:
    	  (IDebugger::Variable::build_qname): Adjust. Don't use equality
    	operator to test pointer nullity, rather use the bool () operator.
---
 src/common/nmv-safe-ptr.h      |    5 +++++
 src/dbgengine/nmv-i-debugger.h |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/common/nmv-safe-ptr.h b/src/common/nmv-safe-ptr.h
index a501017..f2591a3 100644
--- a/src/common/nmv-safe-ptr.h
+++ b/src/common/nmv-safe-ptr.h
@@ -142,6 +142,11 @@ public:
         return m_pointer == a_safe_ptr.m_pointer ;
     }
 
+    bool operator== (const PointerType *a_ptr) const
+    {
+        return m_pointer == a_ptr ;
+    }
+
     bool operator! () const
     {
         if (m_pointer)
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index fde96f3..03abdc0 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -443,7 +443,7 @@ public:
         void build_qname (UString &a_qname) const
         {
             UString qname;
-            if (parent () == 0) {
+            if (!parent ()) {
                 a_qname = name ();
                 if (!a_qname.raw ().empty () && a_qname.raw ()[0] == '*') {
                     a_qname.erase (0, 1);
@@ -465,7 +465,7 @@ public:
         void build_qualified_internal_name (UString &a_qname) const
         {
             UString qname;
-            if (parent () == 0) {
+            if (!parent ()) {
                 a_qname = internal_name ();
             } else if (parent ()) {
                 parent ()->build_qname (qname);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]