aboutsummaryrefslogtreecommitdiffstats
path: root/res/ael/pval.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-09 17:18:03 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-09 17:18:03 +0000
commit7806fa9c29e9e713e7fb5b4eec2b551b76549a30 (patch)
tree136e5a34f59d2dc1180e378ba5dc4c9b265f4dc4 /res/ael/pval.c
parent47875ca1301cfd3f025e426d9ea9aef4d5fca1dc (diff)
Merged revisions 162013 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r162013 | murf | 2008-12-09 09:31:55 -0700 (Tue, 09 Dec 2008) | 45 lines (closes issue #14019) Reported by: ckjohnsonme Patches: 14019.diff uploaded by murf (license 17) Tested by: ckjohnsonme, murf This crash was the result of a few small errors that would combine in 64-bit land to result in a crash. 32-bit land might have seen these combine to mysteriously drop the args to an application call, in certain circumstances. Also, in trying to find this bug, I spotted a situation in the flex input, where, in passing back a 'word' to the parser, it would allocate a buffer larger than necessary. I changed the usage in such situations, so that strdup was not used, but rather, an ast_malloc, followed by ast_copy_string. I removed a field from the pval struct, in u2, that was never getting used, and set in one spot in the code. I believe it was an artifact of a previous fix to make switch cases work invisibly with extens. And, for goto's I removed a '!' from before a strcmp, that has been there since the initial merging of AEL2, that might prevent the proper target of a goto from being found. This was pretty harmless on its own, as it would just louse up a consistency check for users. Many thanks to ckjohnsonme for providing a simplified and complete set of information about the bug, that helped considerably in finding and fixing the problem. Now, to get aelparse up and running again in trunk, and out of its "horribly broken" state, so I can run the regression suite! ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@162079 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/ael/pval.c')
-rw-r--r--res/ael/pval.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/res/ael/pval.c b/res/ael/pval.c
index e8e8dcd53..8ee603aae 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -695,7 +695,7 @@ static int extension_matches(pval *here, const char *exten, const char *pattern)
regex_t preg;
/* simple case, they match exactly, the pattern and exten name */
- if (!strcmp(pattern,exten) == 0)
+ if (strcmp(pattern,exten) == 0)
return 1;
if (pattern[0] == '_') {
@@ -3441,7 +3441,7 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
pr->type = AEL_APPCALL;
p->u2.goto_target = get_goto_target(p);
if( p->u2.goto_target ) {
- p->u3.goto_target_in_case = p->u2.goto_target->u2.label_in_case = label_inside_case(p->u2.goto_target);
+ p->u3.goto_target_in_case = label_inside_case(p->u2.goto_target);
}
if (!p->u1.list->next) /* just one */ {
@@ -5788,50 +5788,3 @@ pval * linku1(pval *head, pval *tail)
return head;
}
-#ifdef HERE_BY_MISTAKE_I_THINK
-static char *config = "extensions.ael";
-int do_pbx_load_module(void)
-{
- int errs, sem_err, sem_warn, sem_note;
- char *rfilename;
- struct ast_context *local_contexts=NULL, *con;
- struct pval *parse_tree;
-
- ast_log(LOG_NOTICE, "Starting AEL load process.\n");
- if (config[0] == '/')
- rfilename = (char *)config;
- else {
- rfilename = alloca(strlen(config) + strlen(ast_config_AST_CONFIG_DIR) + 2);
- sprintf(rfilename, "%s/%s", ast_config_AST_CONFIG_DIR, config);
- }
- ast_log(LOG_NOTICE, "AEL load process: calculated config file name '%s'.\n", rfilename);
-
- if (access(rfilename,R_OK) != 0) {
- ast_log(LOG_NOTICE, "File %s not found; AEL declining load\n", rfilename);
- return AST_MODULE_LOAD_DECLINE;
- }
-
- parse_tree = ael2_parse(rfilename, &errs);
- ast_log(LOG_DEBUG, "AEL load process: parsed config file name '%s'.\n", rfilename);
- ael2_semantic_check(parse_tree, &sem_err, &sem_warn, &sem_note);
- if (errs == 0 && sem_err == 0) {
- ast_log(LOG_DEBUG, "AEL load process: checked config file name '%s'.\n", rfilename);
- ast_compile_ael2(&local_contexts, parse_tree);
- ast_log(LOG_DEBUG, "AEL load process: compiled config file name '%s'.\n", rfilename);
-
- ast_merge_contexts_and_delete(&local_contexts, registrar);
- ast_log(LOG_DEBUG, "AEL load process: merged config file name '%s'.\n", rfilename);
- for (con = ast_walk_contexts(NULL); con; con = ast_walk_contexts(con))
- ast_context_verify_includes(con);
- ast_log(LOG_DEBUG, "AEL load process: verified config file name '%s'.\n", rfilename);
- } else {
- ast_log(LOG_ERROR, "Sorry, but %d syntax errors and %d semantic errors were detected. It doesn't make sense to compile.\n", errs, sem_err);
- destroy_pval(parse_tree); /* free up the memory */
- return AST_MODULE_LOAD_FAILURE;
- }
- destroy_pval(parse_tree); /* free up the memory */
-
- return AST_MODULE_LOAD_SUCCESS;
-}
-#endif
-