bug-libmatheval
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Bug-libmatheval] segmentation fault using matheval


From: Ferrarese Leopoldo
Subject: RE: [Bug-libmatheval] segmentation fault using matheval
Date: Mon, 23 Aug 2004 10:16:54 +0200

HI,
I'm just returned from holiday! :)

>Must confess I still don't understand problem exactly.  If
>evaluator_create() returned NULL, you should issue an error message to
>user stating that syntax of his expression is wrong and you shouldn't
>call any other function before calling evaluator_create() again
>(presumably with corrected expression passed).  Specifically, if
>evaluator_create() returned NULL, you shouldn't call evaluator_destroy()
>with NULL as an argument.
Mhh, maybe I don't explain the problem very well:
When I call evaluator_create() with a function string "wrong", like "log(2)++2" 
the 
evaluator_create() return NULL, it's correct, but if I call evaluator_create() 
again, with a correct function, like ("1+1"), the evaluator_create() return 
NULL! so, the function don't work. I will wait 1 or 2 second and after it work 
fine.
Or I destroy a pointer create correctly, and after the evaluator_create() work 
fine...
But this solution don't work well for my application, because there are a great 
number of wrong math funcion and after few minutes the application don't work 
well....
Now I create a filter to call the evaluator_create() only when the string is a 
math expression...
 

>Could you eventually supply a piece of C code like one I supplied in my
>previous message (preferably your CGI program stripped), that would help
>me to understand how exactly are you manipulating with evaluators?

 
in the initialization module:
function_safe=evaluator_create("1+1\0");

in the calc module:
f = evaluator_create(string);
if (f==NULL) 
   {
    if (function_safe!=NULL) evaluator_destroy(function_safe);
    function_safe=evaluator_create("1+1\0");
   }

very simple...

thank you,
Leo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]