[Asterisk-cvs] asterisk/utils Makefile, 1.14, 1.15 check_expr.c, 1.2, 1.3

kpfleming kpfleming
Mon Aug 29 18:02:18 CDT 2005


Update of /usr/cvsroot/asterisk/utils
In directory mongoose.digium.com:/tmp/cvs-serv13964/utils

Modified Files:
	Makefile check_expr.c 
Log Message:
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


Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/utils/Makefile,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Makefile	22 Aug 2005 19:29:29 -0000	1.14
+++ Makefile	29 Aug 2005 22:03:37 -0000	1.15
@@ -40,6 +40,7 @@
 
 clean:
 	rm -f *.o astman smsq stereorize check_expr .depend
+	rm -f ast_expr2.o ast_expr2f.o
 
 astman: astman.o ../md5.o
 	$(CC) $(CFLAGS) -o astman astman.o ../md5.o -lnewt
@@ -47,8 +48,14 @@
 stereorize: stereorize.o frame.o
 	$(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm
 
-check_expr : check_expr.c ../ast_expr.a
-	$(CC) $(CFLAGS) -o check_expr check_expr.c ../ast_expr.a
+ast_expr2.o: ../ast_expr2.c
+	gcc -g -c -o $@ $<
+
+ast_expr2f.o: ../ast_expr2f.c
+	gcc -g -c -DSTANDALONE -o $@ $<
+
+check_expr: check_expr.c ast_expr2.o ast_expr2f.o
+	$(CC) $(CFLAGS) -o $@ $^
 
 smsq: smsq.o
 	$(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt

Index: check_expr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils/check_expr.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- check_expr.c	21 Jun 2005 20:16:51 -0000	1.2
+++ check_expr.c	29 Aug 2005 22:03:37 -0000	1.3
@@ -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_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 @@
 	*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;
 	}




More information about the svn-commits mailing list