[asterisk-commits] trunk r15022 - in /trunk: cdr.c channels/chan_agent.c manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Mar 26 09:08:45 MST 2006


Author: russell
Date: Sun Mar 26 10:08:42 2006
New Revision: 15022

URL: http://svn.digium.com/view/asterisk?rev=15022&view=rev
Log:
conversions to S_OR (issue #6803)

Modified:
    trunk/cdr.c
    trunk/channels/chan_agent.c
    trunk/manager.c

Modified: trunk/cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr.c?rev=15022&r1=15021&r2=15022&view=diff
==============================================================================
--- trunk/cdr.c (original)
+++ trunk/cdr.c Sun Mar 26 10:08:42 2006
@@ -439,7 +439,7 @@
 
 	while (cdr) {
 		next = cdr->next;
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_POSTED) && !ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' not posted\n", chan);
 		if (ast_tvzero(cdr->end))
@@ -464,7 +464,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 			if (!ast_tvzero(cdr->start))
@@ -480,7 +480,7 @@
 	char *chan; 
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (cdr->disposition < AST_CDR_ANSWERED)
@@ -497,7 +497,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 			if (cdr->disposition < AST_CDR_BUSY)
@@ -512,7 +512,7 @@
 	char *chan; 
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
@@ -554,7 +554,7 @@
 	char *chan; 
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
@@ -569,7 +569,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 				ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 			if (!app)
@@ -617,7 +617,7 @@
 
 	while (cdr) {
 		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-			chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+			chan = S_OR(cdr->channel, "<unknown>");
 			if (!ast_strlen_zero(cdr->channel)) 
 				ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan); 
 			ast_copy_string(cdr->channel, c->name, sizeof(cdr->channel));
@@ -652,7 +652,7 @@
 	char *chan;
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (ast_tvzero(cdr->end))
@@ -778,8 +778,8 @@
 			/* Copy account code et-al */	
 			ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
 			/* Destination information */
-			ast_copy_string(cdr->dst, (ast_strlen_zero(c->macroexten)) ? c->exten : c->macroexten, sizeof(cdr->dst));
-			ast_copy_string(cdr->dcontext, (ast_strlen_zero(c->macrocontext)) ? c->context : c->macrocontext, sizeof(cdr->dcontext));
+			ast_copy_string(cdr->dst, S_OR(c->macroexten, c->exten), sizeof(cdr->dst));
+			ast_copy_string(cdr->dcontext, S_OR(c->macrocontext, c->context), sizeof(cdr->dcontext));
 		}
 		cdr = cdr->next;
 	}
@@ -806,7 +806,7 @@
 	struct ast_cdr_beitem *i;
 
 	while (cdr) {
-		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+		chan = S_OR(cdr->channel, "<unknown>");
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (ast_tvzero(cdr->end))

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?rev=15022&r1=15021&r2=15022&view=diff
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Sun Mar 26 10:08:42 2006
@@ -1230,7 +1230,7 @@
 	if(!chan) 
 		return 0;
 
-	snprintf(loginchan, sizeof(loginchan), "%s@%s", chan, !ast_strlen_zero(context) ? context : "default");
+	snprintf(loginchan, sizeof(loginchan), "%s@%s", chan, S_OR(context,"default"));
 	
 	AST_LIST_TRAVERSE(&agents, p, list) {
 		if(!strcasecmp(chan, p->loginchan))

Modified: trunk/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/manager.c?rev=15022&r1=15021&r2=15022&view=diff
==============================================================================
--- trunk/manager.c (original)
+++ trunk/manager.c Sun Mar 26 10:08:42 2006
@@ -998,13 +998,13 @@
 
 	if (!ast_strlen_zero(in->app)) {
 		res = ast_pbx_outgoing_app(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->app, in->appdata, &reason, 1, 
-			!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, 
-			!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
+			S_OR(in->cid_num, NULL), 
+			S_OR(in->cid_name, NULL),
 			in->vars, in->account, &chan);
 	} else {
 		res = ast_pbx_outgoing_exten(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1, 
-			!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, 
-			!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
+			S_OR(in->cid_num, NULL), 
+			S_OR(in->cid_name, NULL),
 			in->vars, in->account, &chan);
 	}   
 	



More information about the asterisk-commits mailing list