272
edits
No edit summary |
No edit summary |
||
| Line 47: | Line 47: | ||
identity.swap(*aIdentity) | identity.swap(*aIdentity) | ||
return NS_OK; | return NS_OK; | ||
Bad: | |||
*aIdentity = m_identity; | |||
NS_IF_ADDREF(*aIdentity); | |||
Good: | |||
NS_IF_ADDREF(*aIdentity = m_identity); | |||
This saves the cost of a reference count. Don't do this when the nsCOMPtr object is a member variable of a class or you want to use | This saves the cost of a reference count. Don't do this when the nsCOMPtr object is a member variable of a class or you want to use | ||
edits