]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
more small simplifications
authorLuigi Rizzo <rizzo@icir.org>
Tue, 9 May 2006 06:04:45 +0000 (06:04 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Tue, 9 May 2006 06:04:45 +0000 (06:04 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@25856 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c

diff --git a/pbx.c b/pbx.c
index fd1b4f55f6fc8a3a64b99090dba997a3e55708f9..f64616a2fab73c6249adc1b30202521ef9f77515 100644 (file)
--- 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)