aboutsummaryrefslogtreecommitdiffstats
path: root/utils/check_expr.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 /utils/check_expr.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 'utils/check_expr.c')
-rwxr-xr-xutils/check_expr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/utils/check_expr.c b/utils/check_expr.c
index 0814f1dae..89ff155b9 100755
--- a/utils/check_expr.c
+++ b/utils/check_expr.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
+#include <../include/asterisk/ast_expr.h>
int global_lineno = 1;
int global_expr_count = 0;
@@ -120,11 +121,12 @@ int check_expr(char *buffer, char *error_report)
int check_eval(char *buffer, char *error_report)
{
- char *cp, *ep, *xp, *s;
+ char *cp, *ep, *xp;
+ char s[4096];
char evalbuf[80000];
- extern char *ast_expr(char *);
int oplen = 0;
int warn_found = 0;
+ int result;
error_report[0] = 0;
ep = evalbuf;
@@ -179,12 +181,11 @@ int check_eval(char *buffer, char *error_report)
*ep++ = 0;
/* now, run the test */
- s = ast_expr(evalbuf);
- if (s) {
+ result = ast_expr(evalbuf, s, sizeof(s));
+ if (result) {
sprintf(error_report,"line %d, evaluation of $[ %s ] result: %s\n", global_lineno, evalbuf, s);
return 1;
- }
- else {
+ } else {
sprintf(error_report,"line %d, evaluation of $[ %s ] result: ****SYNTAX ERROR****\n", global_lineno, evalbuf);
return 1;
}