[asterisk-commits] russell: trunk r39058 - /trunk/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Aug 6 17:26:12 MST 2006


Author: russell
Date: Sun Aug  6 19:26:11 2006
New Revision: 39058

URL: http://svn.digium.com/view/asterisk?rev=39058&view=rev
Log:
minor cleanups
- use appropriate types in some assignments
- use ast_strlen_zero()
- don't manually free cid fields since ast_set_callerid() will handle it

Modified:
    trunk/channels/chan_zap.c

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?rev=39058&r1=39057&r2=39058&view=diff
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Sun Aug  6 19:26:11 2006
@@ -6020,7 +6020,7 @@
 					    chan->_state == AST_STATE_RINGING) 
 						break; /* Got ring */
 				}
-				dtmfbuf[i] = 0;
+				dtmfbuf[i] = '\0';
 				zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
 				/* Got cid and ring. */
 				ast_log(LOG_DEBUG, "CID got string '%s'\n", dtmfbuf);
@@ -6028,10 +6028,10 @@
 				ast_log(LOG_DEBUG, "CID is '%s', flags %d\n", 
 					dtmfcid, flags);
 				/* If first byte is NULL, we have no cid */
-				if (dtmfcid[0]) 
+				if (!ast_strlen_zero(dtmfcid)) 
 					number = dtmfcid;
 				else
-					number = 0;
+					number = NULL;
 			/* If set to use V23 Signalling, launch our FSK gubbins and listen for it */
 			} else if ((p->cid_signalling == CID_SIG_V23) || (p->cid_signalling == CID_SIG_V23_JP)) {
 				cs = callerid_new(p->cid_signalling);
@@ -6396,24 +6396,17 @@
 		}
 		else
 			cs = NULL;
-		if (number || name) {
-		    if (chan->cid.cid_num) {
-			free(chan->cid.cid_num);
-			chan->cid.cid_num = NULL;
-		    }
-		    if (chan->cid.cid_name) {
-			free(chan->cid.cid_name);
-			chan->cid.cid_name = NULL;
-		    }
-		}
+
 		if (number)
 			ast_shrink_phone_number(number);
-
 		ast_set_callerid(chan, number, name, number);
+
 		if (smdi_msg)
 			ASTOBJ_UNREF(smdi_msg, ast_smdi_md_message_destroy);
+
 		if (cs)
 			callerid_free(cs);
+
 		ast_setstate(chan, AST_STATE_RING);
 		chan->rings = 1;
 		p->ringt = p->ringt_base;



More information about the asterisk-commits mailing list