Fix trunk brokenness; also, optimize application registration
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 20 Jun 2007 23:31:08 +0000 (23:31 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 20 Jun 2007 23:31:08 +0000 (23:31 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@70610 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c
main/pbx.c

index e82eed7..51b8397 100644 (file)
@@ -4808,7 +4808,7 @@ static int load_module(void)
        if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END)))
                res = -1;
 
-       return res;
+       return res ? AST_MODULE_LOAD_DECLINE : 0;
 }
 
 static int reload(void)
index dba568a..471c1c3 100644 (file)
@@ -2940,15 +2940,16 @@ int ast_register_application(const char *app, int (*execute)(struct ast_channel
 {
        struct ast_app *tmp, *cur = NULL;
        char tmps[80];
-       int length;
+       int length, res;
 
        AST_RWLIST_WRLOCK(&apps);
        AST_RWLIST_TRAVERSE(&apps, tmp, list) {
-               if (!strcasecmp(app, tmp->name)) {
+               if (!(res = strcasecmp(app, tmp->name))) {
                        ast_log(LOG_WARNING, "Already have an application '%s'\n", app);
                        AST_RWLIST_UNLOCK(&apps);
                        return -1;
-               }
+               } else if (res < 0)
+                       break;
        }
 
        length = sizeof(*tmp) + strlen(app) + 1;