From: Tilghman Lesher Date: Wed, 20 Jun 2007 23:31:08 +0000 (+0000) Subject: Fix trunk brokenness; also, optimize application registration X-Git-Tag: 1.6.0-beta1~3^2~2307 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=396a37eba813394b699e27d02a026149f19cabc5;p=thirdparty%2Fasterisk.git Fix trunk brokenness; also, optimize application registration git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@70610 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index e82eed70f0..51b83970cc 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -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) diff --git a/main/pbx.c b/main/pbx.c index dba568a450..471c1c3d25 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -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;