aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-06 02:29:18 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-06 02:29:18 +0000
commit7b1b9f53ef47abd82c6faba12f4adcf721e622da (patch)
treebe967c9ab3099202d13219196b5f17284a939e78 /pbx.c
parentd39208dd35ce0ead92bf6a4b21361f3d13759589 (diff)
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
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c17
1 files changed, 3 insertions, 14 deletions
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) {