diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-05-11 09:29:37 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-05-11 09:29:37 +0000 |
commit | 798b82e184fcc6ba9c31ac025ad7d0674b09178f (patch) | |
tree | 80c1b95c5a4d41a99d3fc0e4fa18268b89dc4859 /channels | |
parent | 067c472abbe4963f0667ce82a0bd786e478d12e3 (diff) |
replace list unlinking with UNLINK macro
(when the list becomes an astobj this will be revisited;
however at the moment the change would be too intrusive).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c87e9d013..ea5e9312a 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1259,6 +1259,15 @@ static const struct ast_channel_tech sip_tech = { .send_text = sip_sendtext, }; +/**--- some list management macros. **/ + +#define UNLINK(element, head, prev) do { \ + if (prev) \ + (prev)->next = (element)->next; \ + else \ + (head) = (element)->next; \ + } while (0) + /*! \brief Interface structure with callbacks used to connect to RTP module */ static struct ast_rtp_protocol sip_rtp = { type: "SIP", @@ -1716,10 +1725,7 @@ static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int p->pendinginvite = 0; } /* this is our baby */ - if (prev) - prev->next = cur->next; - else - p->packets = cur->next; + UNLINK(cur, p->packets, prev); if (cur->retransid > -1) { if (sipdebug && option_debug > 3) ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid); @@ -2487,10 +2493,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner) for (prev = NULL, cur = iflist; cur; prev = cur, cur = cur->next) { if (cur == p) { - if (prev) - prev->next = cur->next; - else - iflist = cur->next; + UNLINK(cur, iflist, prev); break; } } |