From 558f8be1b81fd211756afb3f3814490bfc0763d7 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 29 Aug 2005 22:03:37 +0000 Subject: 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: http://svn.digium.com/svn/asterisk/trunk@6440 f38db490-d61c-443f-a65b-d21fe96a405b --- pbx.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'pbx.c') diff --git a/pbx.c b/pbx.c index 75c94ab76..48892cbb2 100755 --- a/pbx.c +++ b/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; -- cgit v1.2.3