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

View File

@@ -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