normalize code, remove some useless casts

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Luigi Rizzo 19 years ago
parent afa37c0194
commit fbba50a613

26
pbx.c

@ -701,15 +701,12 @@ int ast_extension_close(const char *pattern, const char *data, int needmore)
struct ast_context *ast_context_find(const char *name) struct ast_context *ast_context_find(const char *name)
{ {
struct ast_context *tmp; struct ast_context *tmp = NULL;
ast_mutex_lock(&conlock); ast_mutex_lock(&conlock);
if (name) { while ( (tmp = ast_walk_contexts(tmp)) ) {
for (tmp = contexts; tmp; tmp = tmp->next) { if (!name || !strcasecmp(name, tmp->name))
if (!strcasecmp(name, tmp->name)) break;
break; }
}
} else
tmp = contexts;
ast_mutex_unlock(&conlock); ast_mutex_unlock(&conlock);
return tmp; return tmp;
} }
@ -780,7 +777,8 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
if (bypass) /* bypass means we only look there */ if (bypass) /* bypass means we only look there */
tmp = bypass; tmp = bypass;
else { /* look in contexts */ else { /* look in contexts */
for (tmp = contexts; tmp; tmp = tmp->next) { tmp = NULL;
while ((tmp = ast_walk_contexts(tmp)) ) {
if (!strcmp(tmp->name, context)) if (!strcmp(tmp->name, context))
break; break;
} }
@ -4952,8 +4950,8 @@ static int pbx_builtin_wait(struct ast_channel *chan, void *data)
int ms; int ms;
/* Wait for "n" seconds */ /* Wait for "n" seconds */
if (data && atof((char *)data)) { if (data && atof(data)) {
ms = atof((char *)data) * 1000; ms = atof(data) * 1000;
return ast_safe_sleep(chan, ms); return ast_safe_sleep(chan, ms);
} }
return 0; return 0;
@ -5398,7 +5396,7 @@ static int pbx_builtin_saydigits(struct ast_channel *chan, void *data)
int res = 0; int res = 0;
if (data) if (data)
res = ast_say_digit_str(chan, (char *)data, "", chan->language); res = ast_say_digit_str(chan, data, "", chan->language);
return res; return res;
} }
@ -5407,7 +5405,7 @@ static int pbx_builtin_saycharacters(struct ast_channel *chan, void *data)
int res = 0; int res = 0;
if (data) if (data)
res = ast_say_character_str(chan, (char *)data, "", chan->language); res = ast_say_character_str(chan, data, "", chan->language);
return res; return res;
} }
@ -5416,7 +5414,7 @@ static int pbx_builtin_sayphonetic(struct ast_channel *chan, void *data)
int res = 0; int res = 0;
if (data) if (data)
res = ast_say_phonetic_str(chan, (char *)data, "", chan->language); res = ast_say_phonetic_str(chan, data, "", chan->language);
return res; return res;
} }

Loading…
Cancel
Save