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 --- ast_expr2.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ast_expr2.c') diff --git a/ast_expr2.c b/ast_expr2.c index 685276a11..c841616f5 100755 --- a/ast_expr2.c +++ b/ast_expr2.c @@ -1734,7 +1734,7 @@ to_string (struct val *vp) return; } - sprintf (tmp, "%ld", vp->u.i); + sprintf(tmp, "%ld", (long int) vp->u.i); vp->type = AST_EXPR_string; vp->u.s = tmp; } @@ -1775,11 +1775,12 @@ void ast_log(int level, const char *file, int line, const char *function, const int main(int argc,char **argv) { - char *s; - - s=ast_expr(argv[1]); - - printf("=====%s======\n",s); + char s[4096]; + + if (ast_expr(argv[1], s, sizeof(s))) + printf("=====%s======\n",s); + else + printf("No result\n"); } #endif -- cgit v1.2.3