From 9ef4282e9e32e857f4d0cac9df6d58f2cba159f4 Mon Sep 17 00:00:00 2001 From: reinelt Date: Wed, 3 Mar 2004 03:47:04 +0000 Subject: [lcd4linux @ 2004-03-03 03:47:04 by reinelt] big patch from Martin Hejl: - use qprintf() where appropriate - save CPU cycles on gettimeofday() - add quit() functions to free allocated memory - fixed lots of memory leaks git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@384 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- evaluator.c | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'evaluator.c') diff --git a/evaluator.c b/evaluator.c index 17fee4c..7700c5a 100644 --- a/evaluator.c +++ b/evaluator.c @@ -1,4 +1,4 @@ -/* $Id: evaluator.c,v 1.13 2004/02/26 21:42:45 reinelt Exp $ +/* $Id: evaluator.c,v 1.14 2004/03/03 03:47:04 reinelt Exp $ * * expression evaluation * @@ -10,6 +10,13 @@ * FIXME: GPL or not GPL???? * * $Log: evaluator.c,v $ + * Revision 1.14 2004/03/03 03:47:04 reinelt + * big patch from Martin Hejl: + * - use qprintf() where appropriate + * - save CPU cycles on gettimeofday() + * - add quit() functions to free allocated memory + * - fixed lots of memory leaks + * * Revision 1.13 2004/02/26 21:42:45 reinelt * memory leak fixes from Martin * @@ -396,7 +403,7 @@ int SetVariable (char *name, RESULT *value) V=bsearch(name, Variable, nVariable, sizeof(VARIABLE), v_lookup); if (V!=NULL) { FreeResult (V->value); - V->value=DupResult(value); + V->value=(value); return 1; } @@ -413,6 +420,17 @@ int SetVariable (char *name, RESULT *value) return 0; } +void DeleteVariables(void) { + int i; + + for (i=0;i= R2N(&operand)); + value = (R2N(result) >= R2N(&operand)); else - value = (R2N(result) > R2N(&operand)); + value = (R2N(result) > R2N(&operand)); SetResult(&result, R_NUMBER, &value); } + DelResult(&operand); } @@ -738,6 +771,7 @@ static void Level08 (RESULT *result) free (s3); } } + DelResult(&operand); } @@ -764,6 +798,7 @@ static void Level09 (RESULT *result) } SetResult(&result, R_NUMBER, &value); } + DelResult(&operand); } @@ -781,6 +816,7 @@ static void Level10 (RESULT *result) value = pow(R2N(result), R2N(&exponent)); SetResult(&result, R_NUMBER, &value); } + DelResult(&exponent); } -- cgit v1.2.3