mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 00:00:09 +00:00
replace a macro with actual code;
mark dubious code with XXX. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26686 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
52
pbx.c
52
pbx.c
@@ -4218,7 +4218,9 @@ static void null_datad(void *foo)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief add the extension in the priority chain */
|
/*! \brief add the extension in the priority chain.
|
||||||
|
* returns 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
static int add_pri(struct ast_context *con, struct ast_exten *tmp,
|
static int add_pri(struct ast_context *con, struct ast_exten *tmp,
|
||||||
struct ast_exten *el, struct ast_exten *e, int replace)
|
struct ast_exten *el, struct ast_exten *e, int replace)
|
||||||
{
|
{
|
||||||
@@ -4306,21 +4308,6 @@ int ast_add_extension2(struct ast_context *con,
|
|||||||
const char *application, void *data, void (*datad)(void *),
|
const char *application, void *data, void (*datad)(void *),
|
||||||
const char *registrar)
|
const char *registrar)
|
||||||
{
|
{
|
||||||
|
|
||||||
#define LOG do { if (option_debug) {\
|
|
||||||
if (tmp->matchcid) { \
|
|
||||||
ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s\n", tmp->exten, tmp->priority, tmp->cidmatch, con->name); \
|
|
||||||
} else { \
|
|
||||||
ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s\n", tmp->exten, tmp->priority, con->name); \
|
|
||||||
} \
|
|
||||||
} else if (option_verbose > 2) { \
|
|
||||||
if (tmp->matchcid) { \
|
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "Added extension '%s' priority %d (CID match '%s')to %s\n", tmp->exten, tmp->priority, tmp->cidmatch, con->name); \
|
|
||||||
} else { \
|
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "Added extension '%s' priority %d to %s\n", tmp->exten, tmp->priority, con->name); \
|
|
||||||
} \
|
|
||||||
} } while(0)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sort extensions (or patterns) according to the rules indicated above.
|
* Sort extensions (or patterns) according to the rules indicated above.
|
||||||
* These are implemented by the function ext_cmp()).
|
* These are implemented by the function ext_cmp()).
|
||||||
@@ -4337,7 +4324,7 @@ int ast_add_extension2(struct ast_context *con,
|
|||||||
contains variable references, then expand them
|
contains variable references, then expand them
|
||||||
*/
|
*/
|
||||||
ast_mutex_lock(&globalslock);
|
ast_mutex_lock(&globalslock);
|
||||||
if ((priority == PRIORITY_HINT) && AST_LIST_FIRST(&globals) && strstr(application, "${")) {
|
if (priority == PRIORITY_HINT && AST_LIST_FIRST(&globals) && strstr(application, "${")) {
|
||||||
pbx_substitute_variables_varshead(&globals, application, expand_buf, sizeof(expand_buf));
|
pbx_substitute_variables_varshead(&globals, application, expand_buf, sizeof(expand_buf));
|
||||||
application = expand_buf;
|
application = expand_buf;
|
||||||
}
|
}
|
||||||
@@ -4402,15 +4389,13 @@ int ast_add_extension2(struct ast_context *con,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (e && res == 0) { /* exact match, insert in the pri chain */
|
if (e && res == 0) { /* exact match, insert in the pri chain */
|
||||||
int ret = add_pri(con, tmp, el, e, replace);
|
res = add_pri(con, tmp, el, e, replace);
|
||||||
ast_mutex_unlock(&con->lock);
|
ast_mutex_unlock(&con->lock);
|
||||||
if (ret < 0)
|
if (res < 0) {
|
||||||
errno = EEXIST;
|
errno = EEXIST; /* XXX do we care ? */
|
||||||
else {
|
return 0; /* XXX should we return -1 maybe ? */
|
||||||
LOG;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
/*
|
/*
|
||||||
* not an exact match, this is the first entry with this pattern,
|
* not an exact match, this is the first entry with this pattern,
|
||||||
* so insert in the main list right before 'e' (if any)
|
* so insert in the main list right before 'e' (if any)
|
||||||
@@ -4423,7 +4408,24 @@ int ast_add_extension2(struct ast_context *con,
|
|||||||
ast_mutex_unlock(&con->lock);
|
ast_mutex_unlock(&con->lock);
|
||||||
if (tmp->priority == PRIORITY_HINT)
|
if (tmp->priority == PRIORITY_HINT)
|
||||||
ast_add_hint(tmp);
|
ast_add_hint(tmp);
|
||||||
LOG;
|
}
|
||||||
|
if (option_debug) {
|
||||||
|
if (tmp->matchcid) {
|
||||||
|
ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s\n",
|
||||||
|
tmp->exten, tmp->priority, tmp->cidmatch, con->name);
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s\n",
|
||||||
|
tmp->exten, tmp->priority, con->name);
|
||||||
|
}
|
||||||
|
} else if (option_verbose > 2) {
|
||||||
|
if (tmp->matchcid) {
|
||||||
|
ast_verbose( VERBOSE_PREFIX_3 "Added extension '%s' priority %d (CID match '%s')to %s\n",
|
||||||
|
tmp->exten, tmp->priority, tmp->cidmatch, con->name);
|
||||||
|
} else {
|
||||||
|
ast_verbose( VERBOSE_PREFIX_3 "Added extension '%s' priority %d to %s\n",
|
||||||
|
tmp->exten, tmp->priority, con->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user