aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-09 06:04:45 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-09 06:04:45 +0000
commitbacddfcf518c946535e9c72a3259900c1fb488c8 (patch)
tree37cbdcc89cfc3c9db3cfdf9f960dce3c295c12e3 /pbx.c
parent9bf10465a433ef0f28029055c050bfd69df2bd84 (diff)
more small simplifications
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@25856 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rw-r--r--pbx.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/pbx.c b/pbx.c
index fd1b4f55f..f64616a2f 100644
--- a/pbx.c
+++ b/pbx.c
@@ -4183,15 +4183,16 @@ int ast_add_extension2(struct ast_context *con,
tmp->registrar = registrar;
ast_mutex_lock(&con->lock);
- for (e = con->root; e; e = e->next) {
- /* Make sure patterns are always last! */
- if ((e->exten[0] != '_') && (extension[0] == '_'))
+ for (e = con->root; e; el = e, e = e->next) { /* scan the extension list */
+ /* XXX should use ext_cmp() to sort patterns correctly */
+ /* almost strcmp, but make sure patterns are always last! */
+ if (e->exten[0] != '_' && extension[0] == '_')
res = -1;
- else if ((e->exten[0] == '_') && (extension[0] != '_'))
+ else if (e->exten[0] == '_' && extension[0] != '_')
res = 1;
else
res= strcmp(e->exten, extension);
- if (!res) {
+ if (res == 0) { /* extension match, now look at cidmatch */
if (!e->matchcid && !tmp->matchcid)
res = 0;
else if (tmp->matchcid && !e->matchcid)