[asterisk-commits] trunk r15283 - in /trunk: ./ apps/ channels/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 27 12:31:56 MST 2006


Author: mogorman
Date: Mon Mar 27 13:31:54 2006
New Revision: 15283

URL: http://svn.digium.com/view/asterisk?rev=15283&view=rev
Log:
Janitor work converting !ast_strlen_zero(a)?a:b
to S_OR functions. from bug note 6805 with minor
modifications.

Modified:
    trunk/app.c
    trunk/apps/app_dial.c
    trunk/apps/app_directory.c
    trunk/apps/app_dumpchan.c
    trunk/apps/app_meetme.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_vpb.c
    trunk/channels/chan_zap.c
    trunk/cli.c
    trunk/pbx.c
    trunk/res/res_musiconhold.c

Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Mon Mar 27 13:31:54 2006
@@ -1059,7 +1059,7 @@
 	if (ast_strlen_zero(group))
 		return 0;
 
- 	s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
+ 	s = S_OR(category, GROUP_CATEGORY_PREFIX);
 	ast_copy_string(cat, s, sizeof(cat));
 
 	chan = NULL;
@@ -1089,7 +1089,7 @@
 	if (regcomp(&regexbuf, groupmatch, REG_EXTENDED | REG_NOSUB))
 		return 0;
 
-	s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
+	s = S_OR(category, GROUP_CATEGORY_PREFIX);
 	ast_copy_string(cat, s, sizeof(cat));
 
 	chan = NULL;

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Mon Mar 27 13:31:54 2006
@@ -541,7 +541,7 @@
 							senddialevent(in, o->chan);
 							/* After calling, set callerid to extension */
 							if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
-								ast_set_callerid(o->chan, ast_strlen_zero(in->macroexten) ? in->exten : in->macroexten, get_cid_name(cidname, sizeof(cidname), in), NULL);
+								ast_set_callerid(o->chan, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
 						}
 					}
 					/* Hangup the original channel now, in case we needed it */
@@ -1135,7 +1135,7 @@
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
 			if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
-				ast_set_callerid(tmp->chan, ast_strlen_zero(chan->macroexten) ? chan->exten : chan->macroexten, get_cid_name(cidname, sizeof(cidname), chan), NULL);
+				ast_set_callerid(tmp->chan, S_OR(chan->macroexten, chan->exten), get_cid_name(cidname, sizeof(cidname), chan), NULL);
 		}
 		/* Put them in the list of outgoing thingies...  We're ready now. 
 		   XXX If we're forcibly removed, these outgoing calls won't get

Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Mon Mar 27 13:31:54 2006
@@ -179,7 +179,7 @@
 		}
 		ast_stopstream(chan);
 	} else {
-		res = ast_say_character_str(chan, !ast_strlen_zero(name) ? name : ext,
+		res = ast_say_character_str(chan, S_OR(name, ext),
 					AST_DIGIT_ANY, chan->language);
 	}
 

Modified: trunk/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dumpchan.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/apps/app_dumpchan.c (original)
+++ trunk/apps/app_dumpchan.c Mon Mar 27 13:31:54 2006
@@ -126,7 +126,7 @@
 			 ast_print_group(cgrp, sizeof(cgrp), c->callgroup),
 			 ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup),
 			 ( c->appl ? c->appl : "(N/A)" ),
-			 ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
+			 ( c-> data ? S_OR(c->data, "(Empty)") : "(None)"),
 			 (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));
 
 	return 0;

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Mon Mar 27 13:31:54 2006
@@ -1845,8 +1845,8 @@
 				if (!strcasecmp(args.confno, confno)) {
 					/* Bingo it's a valid conference */
 					cnf = build_conf(args.confno,
-							ast_strlen_zero(args.pin) ? "" : args.pin,
-							ast_strlen_zero(args.pinadmin) ? "" : args.pinadmin,
+							S_OR(args.pin, ""),
+							S_OR(args.pinadmin, ""),
 							make, dynamic, refcount);
 					break;
 				}

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Mon Mar 27 13:31:54 2006
@@ -1825,7 +1825,7 @@
 								res = ast_app_getdata(chan, "agent-newlocation", tmpchan+pos, sizeof(tmpchan) - 2, 0);
 							if (ast_strlen_zero(tmpchan) )
 								break;
-							if(ast_exists_extension(chan, !ast_strlen_zero(context) ? context : "default", tmpchan,1, NULL) ) {
+							if(ast_exists_extension(chan, S_OR(context,"default"), tmpchan,1, NULL) ) {
 								if(!allow_multiple_login(tmpchan,context) ) {
 									args.extension = NULL;
 									pos = 0;
@@ -1837,7 +1837,7 @@
 								args.extension = NULL;
 								pos = 0;
 							} else {
-								ast_log(LOG_WARNING, "Extension '%s@%s' is not valid for automatic login of agent '%s'\n", tmpchan, !ast_strlen_zero(context) ? context : "default", p->agent);
+								ast_log(LOG_WARNING, "Extension '%s@%s' is not valid for automatic login of agent '%s'\n", tmpchan, S_OR(context, "default"), p->agent);
 								res = ast_streamfile(chan, "invalid", chan->language);
 								if (!res)
 									res = ast_waitstream(chan, AST_DIGIT_ANY);

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Mar 27 13:31:54 2006
@@ -4618,10 +4618,10 @@
 			if (iaxs[x]->bridgecallno)
 				ast_cli(fd, FORMATB,
 						iaxs[x]->owner ? iaxs[x]->owner->name : "(None)",
-						ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[x]->addr.sin_addr), 
-						!ast_strlen_zero(iaxs[x]->username) ? iaxs[x]->username : "(None)", 
-						iaxs[x]->callno, iaxs[x]->peercallno, 
-						iaxs[x]->oseqno, iaxs[x]->iseqno, 
+						ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[x]->addr.sin_addr),
+						S_OR(iaxs[x]->username, "(None)"),
+						iaxs[x]->callno, iaxs[x]->peercallno,
+						iaxs[x]->oseqno, iaxs[x]->iseqno,
 						iaxs[x]->bridgecallno );
 			else
 #endif
@@ -4646,9 +4646,9 @@
 				ast_cli(fd, FORMAT,
 						iaxs[x]->owner ? iaxs[x]->owner->name : "(None)",
 						ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[x]->addr.sin_addr), 
-						!ast_strlen_zero(iaxs[x]->username) ? iaxs[x]->username : "(None)", 
-						iaxs[x]->callno, iaxs[x]->peercallno, 
-						iaxs[x]->oseqno, iaxs[x]->iseqno, 
+						S_OR(iaxs[x]->username, "(None)"),
+						iaxs[x]->callno, iaxs[x]->peercallno,
+						iaxs[x]->oseqno, iaxs[x]->iseqno,
 						lag,
 						jitter,
 						localdelay,
@@ -5795,7 +5795,7 @@
 	char multi[256];
 	char *stringp, *ext;
 	if (!ast_strlen_zero(regcontext)) {
-		ast_copy_string(multi, ast_strlen_zero(peer->regexten) ? peer->name : peer->regexten, sizeof(multi));
+		ast_copy_string(multi, S_OR(peer->regexten, peer->name), sizeof(multi));
 		stringp = multi;
 		while((ext = strsep(&stringp, "&"))) {
 			if (onoff) {

Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Mon Mar 27 13:31:54 2006
@@ -2641,7 +2641,7 @@
 				if (!tmp->faxhandled) {
 					tmp->faxhandled++;
 					if (strcmp(ast->exten, "fax")) {
-						if (ast_exists_extension(ast, ast_strlen_zero(ast->macrocontext)? ast->context : ast->macrocontext, "fax", 1, AST_CID_P(ast))) {
+						if (ast_exists_extension(ast, S_OR(ast->macrocontext, ast->context), "fax", 1, AST_CID_P(ast))) {
 							if (option_verbose > 2)
 								ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name);
 							/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Mar 27 13:31:54 2006
@@ -1681,7 +1681,8 @@
 	char multi[256];
 	char *stringp, *ext;
 	if (!ast_strlen_zero(global_regcontext)) {
-		ast_copy_string(multi, ast_strlen_zero(peer->regexten) ? peer->name : peer->regexten, sizeof(multi));
+
+		ast_copy_string(multi, S_OR(peer->regexten, peer->name), sizeof(multi));
 		stringp = multi;
 		while((ext = strsep(&stringp, "&"))) {
 			if (onoff)
@@ -3190,7 +3191,7 @@
 	char iabuf[INET_ADDRSTRLEN];
 	char buf[33];
 
-	const char *host = ast_strlen_zero(pvt->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), pvt->ourip) : pvt->fromdomain;
+	const char *host = S_OR(pvt->fromdomain, ast_inet_ntoa(iabuf, sizeof(iabuf), pvt->ourip));
 	
 	ast_string_field_build(pvt, callid, "%s@%s", generate_random_string(buf, sizeof(buf)), host);
 
@@ -3202,7 +3203,7 @@
 	char iabuf[INET_ADDRSTRLEN];
 	char buf[33];
 
-	const char *host = ast_strlen_zero(fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), ourip) : fromdomain;
+	const char *host = S_OR(fromdomain, ast_inet_ntoa(iabuf, sizeof(iabuf), ourip));
 
 	ast_string_field_build(reg, callid, "%s@%s", generate_random_string(buf, sizeof(buf)), host);
 }
@@ -8161,7 +8162,7 @@
 			auth = auth->next;
 		}
 		ast_cli(fd, "  Context      : %s\n", peer->context);
-		ast_cli(fd, "  Subscr.Cont. : %s\n", ast_strlen_zero(peer->subscribecontext)?"<Not set>":peer->subscribecontext);
+		ast_cli(fd, "  Subscr.Cont. : %s\n", S_OR(peer->subscribecontext, "<Not set>") );
 		ast_cli(fd, "  Language     : %s\n", peer->language);
 		if (!ast_strlen_zero(peer->accountcode))
 			ast_cli(fd, "  Accountcode  : %s\n", peer->accountcode);

Modified: trunk/channels/chan_vpb.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_vpb.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/channels/chan_vpb.c (original)
+++ trunk/channels/chan_vpb.c Mon Mar 27 13:31:54 2006
@@ -923,7 +923,7 @@
 			else if (e->data == VPB_FAX){
 				if (!p->faxhandled){
 					if (strcmp(p->owner->exten, "fax")) {
-						const char *target_context = ast_strlen_zero(p->owner->macrocontext) ? p->owner->context : p->owner->macrocontext;
+						const char *target_context = S_OR(p->owner->macrocontext, p->owner->context);
 						
 						if (ast_exists_extension(p->owner, target_context, "fax", 1, p->owner->cid.cid_num)) {
 							if (option_verbose > 2)

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Mon Mar 27 13:31:54 2006
@@ -4559,9 +4559,9 @@
 	}
 
 	if (p->subs[index].needcallerid) {
-		ast_set_callerid(ast, !ast_strlen_zero(p->lastcid_num) ? p->lastcid_num : NULL, 
-							!ast_strlen_zero(p->lastcid_name) ? p->lastcid_name : NULL,
-							!ast_strlen_zero(p->lastcid_num) ? p->lastcid_num : NULL
+		ast_set_callerid(ast, S_OR(p->lastcid_num, NULL),
+							S_OR(p->lastcid_name, NULL),
+							S_OR(p->lastcid_num, NULL)
 							);
 		p->subs[index].needcallerid = 0;
 	}
@@ -4751,7 +4751,7 @@
 			if (!p->faxhandled) {
 				p->faxhandled++;
 				if (strcmp(ast->exten, "fax")) {
-					const char *target_context = ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext;
+					const char *target_context = S_OR(ast->macrocontext, ast->context);
 
 					if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) {
 						if (option_verbose > 2)
@@ -5213,7 +5213,7 @@
 			tmp->cid.cid_dnid = ast_strdup(i->dnid);
 
 #ifdef PRI_ANI
-		ast_set_callerid(tmp, i->cid_num, i->cid_name, ast_strlen_zero(i->cid_ani) ? i->cid_num : i->cid_ani);
+		ast_set_callerid(tmp, i->cid_num, i->cid_name, S_OR(i->cid_ani, i->cid_num));
 #else
 		ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
 #endif
@@ -8760,7 +8760,7 @@
 							if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
 								if (option_verbose > 2)
 									ast_verbose(VERBOSE_PREFIX_3 "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
-										plancallingnum, !ast_strlen_zero(pri->pvts[chanpos]->exten) ? pri->pvts[chanpos]->exten : "<unspecified>", 
+										plancallingnum, S_OR(pri->pvts[chanpos]->exten, "<unspecified>"),
 										pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
 							} else {
 								ast_log(LOG_WARNING, "Unable to start PBX on channel %d/%d, span %d\n", 

Modified: trunk/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/cli.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/cli.c (original)
+++ trunk/cli.c Mon Mar 27 13:31:54 2006
@@ -425,7 +425,7 @@
 			        durbuf, bc ? bc->name : "(None)");
 		} else if (verbose) {
 			ast_cli(fd, VERBOSE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state),
-			        c->appl ? c->appl : "(None)", c->data ? ( !ast_strlen_zero(c->data) ? c->data : "(Empty)" ): "(None)",
+			        c->appl ? c->appl : "(None)", c->data ? S_OR(c->data, "(Empty)" ): "(None)",
 			        c->cid.cid_num ? c->cid.cid_num : "", durbuf,
 			        c->accountcode ? c->accountcode : "", bc ? bc->name : "(None)");
 		} else {
@@ -746,7 +746,7 @@
 		c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup,
 		cdrtime, c->_bridge ? c->_bridge->name : "<none>", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
 		c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
-		( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
+		( c-> data ? S_OR(c->data, "(Empty)") : "(None)"),
 		(ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));
 	
 	if(pbx_builtin_serialize_variables(c,buf,sizeof(buf)))

Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Mon Mar 27 13:31:54 2006
@@ -4311,8 +4311,8 @@
 			tmpchan->writeformat = chan->writeformat;
 			/* Setup proper location */
 			ast_explicit_goto(tmpchan,
-					  (!ast_strlen_zero(context)) ? context : chan->context,
-					  (!ast_strlen_zero(exten)) ? exten : chan->exten,
+					  S_OR(context, chan->context),
+					  S_OR(exten, chan->exten),
 					  priority);
 
 			/* Masquerade into temp channel */

Modified: trunk/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_musiconhold.c?rev=15283&r1=15282&r2=15283&view=diff
==============================================================================
--- trunk/res/res_musiconhold.c (original)
+++ trunk/res/res_musiconhold.c Mon Mar 27 13:31:54 2006
@@ -1127,10 +1127,10 @@
 	ast_mutex_lock(&moh_lock);
 	for (class = mohclasses; class; class = class->next) {
 		ast_cli(fd, "Class: %s\n", class->name);
-		ast_cli(fd, "\tMode: %s\n", ast_strlen_zero(class->mode) ? "<none>" : class->mode);
-		ast_cli(fd, "\tDirectory: %s\n", ast_strlen_zero(class->dir) ? "<none>" : class->dir);
+		ast_cli(fd, "\tMode: %s\n", S_OR(class->mode,"<none>"));
+		ast_cli(fd, "\tDirectory: %s\n", S_OR(class->dir, "<none>"));
 		if (ast_test_flag(class, MOH_CUSTOM))
-			ast_cli(fd, "\tApplication: %s\n", ast_strlen_zero(class->args) ? "<none>" : class->args);
+			ast_cli(fd, "\tApplication: %s\n", S_OR(class->args, "<none>"));
 		ast_cli(fd, "\tFormat: %s\n", ast_getformatname(class->format));
 	}
 	ast_mutex_unlock(&moh_lock);



More information about the asterisk-commits mailing list