chan_sip: Simplify dialog/peer references, improve REF_DEBUG output.

* Replace functions for ref/undef of dialogs and peers with macro's
  to call ao2_t_bump/ao2_t_cleanup.
* Enable passthough of REF_DEBUG caller information to sip_alloc and
  find_call.

ASTERISK-24882 #close 
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4189/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433115 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Corey Farrell
2015-03-19 09:53:37 +00:00
parent 7fddae99dd
commit 958bc84caf
3 changed files with 35 additions and 84 deletions

View File

@@ -1869,14 +1869,7 @@ void sip_auth_headers(enum sip_auth_type code, char **header, char **respheader)
const char *sip_get_header(const struct sip_request *req, const char *name);
const char *sip_get_transport(enum ast_transport t);
#ifdef REF_DEBUG
#define sip_ref_peer(arg1,arg2) _ref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define sip_unref_peer(arg1,arg2) _unref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
struct sip_peer *_ref_peer(struct sip_peer *peer, char *tag, char *file, int line, const char *func);
void *_unref_peer(struct sip_peer *peer, char *tag, char *file, int line, const char *func);
#else
struct sip_peer *sip_ref_peer(struct sip_peer *peer, char *tag);
void *sip_unref_peer(struct sip_peer *peer, char *tag);
#endif /* REF_DEBUG */
#define sip_ref_peer(peer, tag) ao2_t_bump(peer, tag)
#define sip_unref_peer(peer, tag) ({ ao2_t_cleanup(peer, tag); (NULL); })
#endif