[svn-commits] trunk r21820 - /trunk/funcs/func_callerid.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Apr 21 03:51:33 MST 2006


Author: rizzo
Date: Fri Apr 21 05:51:31 2006
New Revision: 21820

URL: http://svn.digium.com/view/asterisk?rev=21820&view=rev
Log:
more NULL "" equivalence in CLI fields.

Mark a place where we don't clear a buffer while we probably should.


Modified:
    trunk/funcs/func_callerid.c

Modified: trunk/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_callerid.c?rev=21820&r1=21819&r2=21820&view=diff
==============================================================================
--- trunk/funcs/func_callerid.c (original)
+++ trunk/funcs/func_callerid.c Fri Apr 21 05:51:31 2006
@@ -42,6 +42,7 @@
 {
 	char *opt = data;
 
+	/* XXX we are not always clearing the buffer. Is this correct ? */
 	if (strchr(opt, '|')) {
 		char name[80], num[80];
 
@@ -62,8 +63,8 @@
 	} else {
 		if (!strncasecmp("all", data, 3)) {
 			snprintf(buf, len, "\"%s\" <%s>",
-				 chan->cid.cid_name ? chan->cid.cid_name : "",
-				 chan->cid.cid_num ? chan->cid.cid_num : "");
+				 S_OR(chan->cid.cid_name, ""),
+				 S_OR(chan->cid.cid_num, ""));
 		} else if (!strncasecmp("name", data, 4)) {
 			if (chan->cid.cid_name) {
 				ast_copy_string(buf, chan->cid.cid_name, len);
@@ -116,12 +117,12 @@
 		/* do we need to lock chan here? */
 		if (chan->cid.cid_dnid)
 			free(chan->cid.cid_dnid);
-		chan->cid.cid_dnid = ast_strlen_zero(value) ? NULL : strdup(value);
+		chan->cid.cid_dnid = ast_strdup(value);
 	} else if (!strncasecmp("rdnis", data, 5)) {
 		/* do we need to lock chan here? */
 		if (chan->cid.cid_rdnis)
 			free(chan->cid.cid_rdnis);
-		chan->cid.cid_rdnis = ast_strlen_zero(value) ? NULL : strdup(value);
+		chan->cid.cid_rdnis = ast_strdup(value);
 	} else {
 		ast_log(LOG_ERROR, "Unknown callerid data type.\n");
 	}



More information about the svn-commits mailing list