From 7b1b9f53ef47abd82c6faba12f4adcf721e622da Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 6 Jun 2005 02:29:18 +0000 Subject: more efficient (and understandable) ast_channel_walk_locked, and vastly more efficient ast_channel_by_name_locked (bug #4265) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5853 f38db490-d61c-443f-a65b-d21fe96a405b --- pbx.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'pbx.c') diff --git a/pbx.c b/pbx.c index 23b000edc..1307f6768 100755 --- a/pbx.c +++ b/pbx.c @@ -4453,14 +4453,7 @@ int ast_async_goto_by_name(const char *channame, const char *context, const char struct ast_channel *chan; int res = -1; - chan = ast_channel_walk_locked(NULL); - while(chan) { - if (!strcasecmp(channame, chan->name)) - break; - ast_mutex_unlock(&chan->lock); - chan = ast_channel_walk_locked(chan); - } - + chan = ast_get_channel_by_name_locked(channame); if (chan) { res = ast_async_goto(chan, context, exten, priority); ast_mutex_unlock(&chan->lock); @@ -5803,7 +5796,7 @@ int pbx_builtin_importvar(struct ast_channel *chan, void *data) char *value; char *stringp=NULL; char *channel; - struct ast_channel *chan2=NULL; + struct ast_channel *chan2; char tmp[4096]=""; char *s; @@ -5817,11 +5810,7 @@ int pbx_builtin_importvar(struct ast_channel *chan, void *data) channel = strsep(&stringp,"|"); value = strsep(&stringp,"\0"); if (channel && value && name) { - while((chan2 = ast_channel_walk_locked(chan2))) { - if (!strcmp(chan2->name, channel)) - break; - ast_mutex_unlock(&chan2->lock); - } + chan2 = ast_get_channel_by_name_locked(channel); if (chan2) { s = alloca(strlen(value) + 4); if (s) { -- cgit v1.2.3