don't make expression evaluator allocate a memory buffer for each result

to
be returned; use the buffers already present in the PBX for this purpose
update testexpr2/check_expr to allocate buffers for expression
evaluation


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6440 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-08-29 22:03:37 +00:00
parent 8b331ab17d
commit 0f03a734b1
9 changed files with 143 additions and 99 deletions

15
pbx.c
View File

@@ -1522,19 +1522,12 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, const ch
vars = var;
}
/* Evaluate expression */
cp4 = ast_expr(vars);
ast_log(LOG_DEBUG, "Expression is '%s'\n", cp4);
if (cp4) {
length = strlen(cp4);
if (length > count)
length = count;
memcpy(cp2, cp4, length);
length = ast_expr(vars, cp2, count);
if (length) {
ast_log(LOG_DEBUG, "Expression result is '%s'\n", cp2);
count -= length;
cp2 += length;
free(cp4);
}
} else
break;