aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-29 22:03:37 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-29 22:03:37 +0000
commit558f8be1b81fd211756afb3f3814490bfc0763d7 (patch)
treee6aa0fcc15c7915e5b37a2267d1c36c2c86f0b19 /pbx.c
parent02052f2d90c56c341514e1b0ed5f62c65f9ea142 (diff)
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
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c15
1 files changed, 4 insertions, 11 deletions
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;