summaryrefslogtreecommitdiff
path: root/main/channel_internal_api.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-03-13 01:12:35 +0000
committerCorey Farrell <git@cfware.com>2015-03-13 01:12:35 +0000
commitc08fd275bf8c45dc09084f104521cbff04eab25b (patch)
tree09cc14b9a9190254980ec88b981d6f561ec8a9b5 /main/channel_internal_api.c
parent38ee441ea7debef3ebf6b162fc290b121fa3588d (diff)
Logger: Convert 'struct ast_callid' to unsigned int.
Switch logger callid's from AO2 objects to simple integers. This helps in two ways. Copying integers is faster than referencing AO2 objects, so this will result in a small reduction in logger overhead. This also erases the possibility of an infinate loop caused by an invalid callid in threadstorage. ASTERISK-24833 #comment Committed callid conversion to trunk. Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4466/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel_internal_api.c')
-rw-r--r--main/channel_internal_api.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 624bdd1cb..0ff844440 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -96,7 +96,7 @@ struct ast_channel {
struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or
* in the CHANNEL dialplan function */
struct ast_channel_monitor *monitor; /*!< Channel monitoring */
- struct ast_callid *callid; /*!< Bound call identifier pointer */
+ ast_callid callid; /*!< Bound call identifier pointer */
#ifdef HAVE_EPOLL
struct ast_epoll_data *epfd_data[AST_MAX_FDS];
#endif
@@ -914,15 +914,11 @@ enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
{
return chan->state;
}
-struct ast_callid *ast_channel_callid(const struct ast_channel *chan)
+ast_callid ast_channel_callid(const struct ast_channel *chan)
{
- if (chan->callid) {
- ast_callid_ref(chan->callid);
- return chan->callid;
- }
- return NULL;
+ return chan->callid;
}
-void ast_channel_callid_set(struct ast_channel *chan, struct ast_callid *callid)
+void ast_channel_callid_set(struct ast_channel *chan, ast_callid callid)
{
char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
@@ -931,11 +927,9 @@ void ast_channel_callid_set(struct ast_channel *chan, struct ast_callid *callid)
if (chan->callid) {
ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
- /* unbind if already set */
- ast_callid_unref(chan->callid);
}
- chan->callid = ast_callid_ref(callid);
+ chan->callid = callid;
ast_test_suite_event_notify("CallIDChange",
"State: CallIDChange\r\n"
@@ -1165,9 +1159,7 @@ void ast_channel_set_unbridged(struct ast_channel *chan, int value)
void ast_channel_callid_cleanup(struct ast_channel *chan)
{
- if (chan->callid) {
- chan->callid = ast_callid_unref(chan->callid);
- }
+ chan->callid = 0;
}
/* Typedef accessors */