[asterisk-commits] trunk r21814 - /trunk/channel.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Apr 21 03:05:46 MST 2006
Author: rizzo
Date: Fri Apr 21 05:05:45 2006
New Revision: 21814
URL: http://svn.digium.com/view/asterisk?rev=21814&view=rev
Log:
make NULL and "" equivalent in cid fields, mark some missing NULL checks.
Modified:
trunk/channel.c
Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=21814&r1=21813&r2=21814&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Fri Apr 21 05:05:45 2006
@@ -2610,8 +2610,8 @@
"CallerIDName: %s\r\n"
"Uniqueid: %s\r\n",
c->name, ast_state2str(c->_state),
- c->cid.cid_num ? c->cid.cid_num : "<unknown>",
- c->cid.cid_name ? c->cid.cid_name : "<unknown>",
+ S_OR(c->cid.cid_num, "<unknown>"),
+ S_OR(c->cid.cid_name, "<unknown>"),
c->uniqueid);
}
return c;
@@ -3155,26 +3155,17 @@
if (callerid) {
if (chan->cid.cid_num)
free(chan->cid.cid_num);
- if (ast_strlen_zero(callerid))
- chan->cid.cid_num = NULL;
- else
- chan->cid.cid_num = strdup(callerid);
+ chan->cid.cid_num = ast_strdup(callerid);
}
if (calleridname) {
if (chan->cid.cid_name)
free(chan->cid.cid_name);
- if (ast_strlen_zero(calleridname))
- chan->cid.cid_name = NULL;
- else
- chan->cid.cid_name = strdup(calleridname);
+ chan->cid.cid_name = ast_strdup(calleridname);
}
if (ani) {
if (chan->cid.cid_ani)
free(chan->cid.cid_ani);
- if (ast_strlen_zero(ani))
- chan->cid.cid_ani = NULL;
- else
- chan->cid.cid_ani = strdup(ani);
+ chan->cid.cid_ani = ast_strdup(ani);
}
if (chan->cdr)
ast_cdr_setcid(chan->cdr, chan);
@@ -3184,10 +3175,9 @@
"CallerIDName: %s\r\n"
"Uniqueid: %s\r\n"
"CID-CallingPres: %d (%s)\r\n",
- chan->name, chan->cid.cid_num ?
- chan->cid.cid_num : "<Unknown>",
- chan->cid.cid_name ?
- chan->cid.cid_name : "<Unknown>",
+ chan->name,
+ S_OR(chan->cid.cid_num, "<Unknown>"),
+ S_OR(chan->cid.cid_name, "<Unknown>"),
chan->uniqueid,
chan->cid.cid_pres,
ast_describe_caller_presentation(chan->cid.cid_pres)
@@ -3211,8 +3201,8 @@
"CallerIDName: %s\r\n"
"Uniqueid: %s\r\n",
chan->name, ast_state2str(chan->_state),
- chan->cid.cid_num ? chan->cid.cid_num : "<unknown>",
- chan->cid.cid_name ? chan->cid.cid_name : "<unknown>",
+ S_OR(chan->cid.cid_num, "<unknown>"),
+ S_OR(chan->cid.cid_name, "<unknown>"),
chan->uniqueid);
return 0;
@@ -3430,7 +3420,8 @@
/* Keep track of bridge */
c0->_bridge = c1;
c1->_bridge = c0;
-
+
+ /* \todo XXX here should check that cid_num is not NULL */
manager_event(EVENT_FLAG_CALL, "Link",
"Channel1: %s\r\n"
"Channel2: %s\r\n"
@@ -3524,6 +3515,7 @@
ast_set_flag(c0, AST_FLAG_NBRIDGE);
ast_set_flag(c1, AST_FLAG_NBRIDGE);
if ((res = c0->tech->bridge(c0, c1, config->flags, fo, rc, to)) == AST_BRIDGE_COMPLETE) {
+ /* \todo XXX here should check that cid_num is not NULL */
manager_event(EVENT_FLAG_CALL, "Unlink",
"Channel1: %s\r\n"
"Channel2: %s\r\n"
@@ -3567,6 +3559,7 @@
!(c0->generator || c1->generator)) {
if (ast_channel_make_compatible(c0, c1)) {
ast_log(LOG_WARNING, "Can't make %s and %s compatible\n", c0->name, c1->name);
+ /* \todo XXX here should check that cid_num is not NULL */
manager_event(EVENT_FLAG_CALL, "Unlink",
"Channel1: %s\r\n"
"Channel2: %s\r\n"
@@ -3588,6 +3581,7 @@
c0->_bridge = NULL;
c1->_bridge = NULL;
+ /* \todo XXX here should check that cid_num is not NULL */
manager_event(EVENT_FLAG_CALL, "Unlink",
"Channel1: %s\r\n"
"Channel2: %s\r\n"
More information about the asterisk-commits
mailing list