aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/pbx_ael.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-05 18:29:06 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-05 18:29:06 +0000
commit5f6e374d846293d9e40e2f32cb6afe26abb0f77c (patch)
treea165c2cbfb30490e3e41bf2367c8aa644112be8e /pbx/pbx_ael.c
parentedd035b318b9266da2c88397af2b1ef1edde3b1e (diff)
These mods fix a problem pointed out by dgartang, where in certain situations, the target of a goto cannot be found, even right under your nose. This is because the current context is not updated properly, and rather than waste time and find why and where the context should have been updated, I just use my newly added 'dad' ptrs, and pop until I have either the context or extension, and use that instead.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44489 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/pbx_ael.c')
-rw-r--r--pbx/pbx_ael.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c
index 42dd00f6f..3aae8660e 100644
--- a/pbx/pbx_ael.c
+++ b/pbx/pbx_ael.c
@@ -850,6 +850,24 @@ static void check_expr2_input(pval *expr, char *str)
}
}
+static void check_includes(pval *includes)
+{
+ struct pval *p4;
+ for (p4=includes->u1.list; p4; p4=p4->next) {
+ /* for each context pointed to, find it, then find a context/label that matches the
+ target here! */
+ char *incl_context = p4->u1.str;
+ /* find a matching context name */
+ struct pval *that_other_context = find_context(incl_context);
+ if (!that_other_context) {
+ ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The included context '%s' cannot be found.\n",
+ includes->filename, includes->startline, includes->endline, incl_context);
+ warns++;
+ }
+ }
+}
+
+
static void check_timerange(pval *p)
{
char times[200];
@@ -1251,7 +1269,10 @@ static void check_goto(pval *item)
/* just one item-- the label should be in the current extension */
if (item->u1.list && !item->u1.list->next && !strstr((item->u1.list)->u1.str,"${")) {
- struct pval *x = find_label_in_current_extension((char*)((item->u1.list)->u1.str), current_extension? current_extension:current_context); /* if in macro, use current context instead */
+ struct pval *z = get_extension_or_contxt(item);
+ struct pval *x = 0;
+ if (z)
+ x = find_label_in_current_extension((char*)((item->u1.list)->u1.str), z); /* if in macro, use current context instead */
/* printf("Called find_label_in_current_extension with arg %s; current_extension is %x: %d\n",
(char*)((item->u1.list)->u1.str), current_extension?current_extension:current_context, current_extension?current_extension->type:current_context->type); */
if (!x) {
@@ -1270,7 +1291,12 @@ static void check_goto(pval *item)
(char*)((item->u1.list)->u1.str), (char *)item->u1.list->next->u1.str); */
if (!strstr((item->u1.list)->u1.str,"${")
&& !strstr(item->u1.list->next->u1.str,"${") ) /* Don't try to match variables */ {
- struct pval *x = find_label_in_current_context((char *)item->u1.list->u1.str, (char *)item->u1.list->next->u1.str, current_context);
+ struct pval *z = get_contxt(item);
+ struct pval *x = 0;
+
+ if (z)
+ x = find_label_in_current_context((char *)item->u1.list->u1.str, (char *)item->u1.list->next->u1.str, z);
+
if (!x) {
ast_log(LOG_ERROR,"Error: file %s, line %d-%d: goto: no label %s|%s exists in the current context, or any of its inclusions!\n",
item->filename, item->startline, item->endline, item->u1.list->u1.str, item->u1.list->next->u1.str );
@@ -2495,6 +2521,7 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals)
/* fields: item->u1.list == pval list of PV_WORD elements, one per entry in the list
*/
check_pval(item->u1.list, apps,in_globals);
+ check_includes(item);
for (lp=item->u1.list; lp; lp=lp->next){
char *incl_context = lp->u1.str;
struct pval *that_context = find_context(incl_context);