Fix trunk brokenness; also, optimize application registration
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@70610 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
764df68426
commit
f718745448
2 changed files with 5 additions and 4 deletions
|
@ -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)))
|
if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END)))
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
||||||
return res;
|
return res ? AST_MODULE_LOAD_DECLINE : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reload(void)
|
static int reload(void)
|
||||||
|
|
|
@ -2940,15 +2940,16 @@ int ast_register_application(const char *app, int (*execute)(struct ast_channel
|
||||||
{
|
{
|
||||||
struct ast_app *tmp, *cur = NULL;
|
struct ast_app *tmp, *cur = NULL;
|
||||||
char tmps[80];
|
char tmps[80];
|
||||||
int length;
|
int length, res;
|
||||||
|
|
||||||
AST_RWLIST_WRLOCK(&apps);
|
AST_RWLIST_WRLOCK(&apps);
|
||||||
AST_RWLIST_TRAVERSE(&apps, tmp, list) {
|
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_log(LOG_WARNING, "Already have an application '%s'\n", app);
|
||||||
AST_RWLIST_UNLOCK(&apps);
|
AST_RWLIST_UNLOCK(&apps);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else if (res < 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = sizeof(*tmp) + strlen(app) + 1;
|
length = sizeof(*tmp) + strlen(app) + 1;
|
||||||
|
|
Reference in a new issue