$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: d.frey_at_[hidden]
Date: 2008-04-22 02:31:33
Author: daniel_frey
Date: 2008-04-22 02:31:32 EDT (Tue, 22 Apr 2008)
New Revision: 44711
URL: http://svn.boost.org/trac/boost/changeset/44711
Log:
Avoid unneccessary increment/decrement of reference count
Text files modified: 
   trunk/boost/detail/shared_count.hpp |    20 ++++++++++++++------                    
   1 files changed, 14 insertions(+), 6 deletions(-)
Modified: trunk/boost/detail/shared_count.hpp
==============================================================================
--- trunk/boost/detail/shared_count.hpp	(original)
+++ trunk/boost/detail/shared_count.hpp	2008-04-22 02:31:32 EDT (Tue, 22 Apr 2008)
@@ -324,9 +324,13 @@
     weak_count & operator= (shared_count const & r) // nothrow
     {
         sp_counted_base * tmp = r.pi_;
-        if(tmp != 0) tmp->weak_add_ref();
-        if(pi_ != 0) pi_->weak_release();
-        pi_ = tmp;
+
+        if( tmp != pi_ )
+        {
+            if(tmp != 0) tmp->weak_add_ref();
+            if(pi_ != 0) pi_->weak_release();
+            pi_ = tmp;
+        }
 
         return *this;
     }
@@ -334,9 +338,13 @@
     weak_count & operator= (weak_count const & r) // nothrow
     {
         sp_counted_base * tmp = r.pi_;
-        if(tmp != 0) tmp->weak_add_ref();
-        if(pi_ != 0) pi_->weak_release();
-        pi_ = tmp;
+
+        if( tmp != pi_ )
+        {
+            if(tmp != 0) tmp->weak_add_ref();
+            if(pi_ != 0) pi_->weak_release();
+            pi_ = tmp;
+        }
 
         return *this;
     }