mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 03:48:02 +00:00
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:
15
pbx.c
15
pbx.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user