Changeset 44711


Ignore:
Timestamp:
Apr 22, 2008, 6:31:32 AM (10 years ago)
Author:
Daniel Frey
Message:

Avoid unneccessary increment/decrement of reference count

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/detail/shared_count.hpp

    r44595 r44711  
    325325    {
    326326        sp_counted_base * tmp = r.pi_;
    327         if(tmp != 0) tmp->weak_add_ref();
    328         if(pi_ != 0) pi_->weak_release();
    329         pi_ = tmp;
     327
     328        if( tmp != pi_ )
     329        {
     330            if(tmp != 0) tmp->weak_add_ref();
     331            if(pi_ != 0) pi_->weak_release();
     332            pi_ = tmp;
     333        }
    330334
    331335        return *this;
     
    335339    {
    336340        sp_counted_base * tmp = r.pi_;
    337         if(tmp != 0) tmp->weak_add_ref();
    338         if(pi_ != 0) pi_->weak_release();
    339         pi_ = tmp;
     341
     342        if( tmp != pi_ )
     343        {
     344            if(tmp != 0) tmp->weak_add_ref();
     345            if(pi_ != 0) pi_->weak_release();
     346            pi_ = tmp;
     347        }
    340348
    341349        return *this;
Note: See TracChangeset for help on using the changeset viewer.