[svn-commits] trunk r26054 - /trunk/pbx.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue May 9 06:52:02 MST 2006


Author: rizzo
Date: Tue May  9 08:52:01 2006
New Revision: 26054

URL: http://svn.digium.com/view/asterisk?rev=26054&view=rev
Log:
normalize code, remove some useless casts


Modified:
    trunk/pbx.c

Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=26054&r1=26053&r2=26054&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Tue May  9 08:52:01 2006
@@ -701,15 +701,12 @@
 
 struct ast_context *ast_context_find(const char *name)
 {
-	struct ast_context *tmp;
+	struct ast_context *tmp = NULL;
 	ast_mutex_lock(&conlock);
-	if (name) {
-		for (tmp = contexts; tmp; tmp = tmp->next) {
-			if (!strcasecmp(name, tmp->name))
-				break;
-		}
-	} else
-		tmp = contexts;
+	while ( (tmp = ast_walk_contexts(tmp)) ) {
+		if (!name || !strcasecmp(name, tmp->name))
+			break;
+	}
 	ast_mutex_unlock(&conlock);
 	return tmp;
 }
@@ -780,7 +777,8 @@
 	if (bypass)	/* bypass means we only look there */
 		tmp = bypass;
 	else {	/* look in contexts */
-		for (tmp = contexts; tmp; tmp = tmp->next) {
+		tmp = NULL;
+		while ((tmp = ast_walk_contexts(tmp)) ) {
 			if (!strcmp(tmp->name, context))
 				break;
 		}
@@ -4952,8 +4950,8 @@
 	int ms;
 
 	/* Wait for "n" seconds */
-	if (data && atof((char *)data)) {
-		ms = atof((char *)data) * 1000;
+	if (data && atof(data)) {
+		ms = atof(data) * 1000;
 		return ast_safe_sleep(chan, ms);
 	}
 	return 0;
@@ -5398,7 +5396,7 @@
 	int res = 0;
 
 	if (data)
-		res = ast_say_digit_str(chan, (char *)data, "", chan->language);
+		res = ast_say_digit_str(chan, data, "", chan->language);
 	return res;
 }
 
@@ -5407,7 +5405,7 @@
 	int res = 0;
 
 	if (data)
-		res = ast_say_character_str(chan, (char *)data, "", chan->language);
+		res = ast_say_character_str(chan, data, "", chan->language);
 	return res;
 }
 
@@ -5416,7 +5414,7 @@
 	int res = 0;
 
 	if (data)
-		res = ast_say_phonetic_str(chan, (char *)data, "", chan->language);
+		res = ast_say_phonetic_str(chan, data, "", chan->language);
 	return res;
 }
 



More information about the svn-commits mailing list