[svn-commits] coreyfarrell: branch 12 r418396 - /branches/12/include/asterisk/astobj2.h
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Jul 11 16:09:51 CDT 2014
Author: coreyfarrell
Date: Fri Jul 11 16:09:43 2014
New Revision: 418396
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418396
Log:
astobj2: tweak ao2_replace to do nothing when it would be a NoOp
This change causes ao2_replace to do nothing when src == dst. This
avoids REF_DEBUG logging when we're not actually doing anything.
Review: https://reviewboard.asterisk.org/r/3743/
Modified:
branches/12/include/asterisk/astobj2.h
Modified: branches/12/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/astobj2.h?view=diff&rev=418396&r1=418395&r2=418396
==============================================================================
--- branches/12/include/asterisk/astobj2.h (original)
+++ branches/12/include/asterisk/astobj2.h Fri Jul 11 16:09:43 2014
@@ -561,13 +561,15 @@
{\
typeof(dst) *__dst_ ## __LINE__ = &dst; \
typeof(src) __src_ ## __LINE__ = src; \
- if (__src_ ## __LINE__) {\
- ao2_ref(__src_ ## __LINE__, +1); \
+ if (__src_ ## __LINE__ != *__dst_ ## __LINE__) { \
+ if (__src_ ## __LINE__) {\
+ ao2_ref(__src_ ## __LINE__, +1); \
+ } \
+ if (*__dst_ ## __LINE__) {\
+ ao2_ref(*__dst_ ## __LINE__, -1); \
+ } \
+ *__dst_ ## __LINE__ = __src_ ## __LINE__; \
} \
- if (*__dst_ ## __LINE__) {\
- ao2_ref(*__dst_ ## __LINE__, -1); \
- } \
- *__dst_ ## __LINE__ = __src_ ## __LINE__; \
}
/*! @} */
More information about the svn-commits
mailing list