mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
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/ ........ Merged revisions 418396 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -561,13 +561,15 @@ int __ao2_ref(void *o, int delta);
|
||||
{\
|
||||
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__; \
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
|
Reference in New Issue
Block a user