]> git.kaiwu.me - klib.git/commitdiff
forgot to deallocate in kexpr example
authorHeng Li <lh3@me.com>
Tue, 16 Aug 2016 21:45:40 +0000 (17:45 -0400)
committerHeng Li <lh3@me.com>
Tue, 16 Aug 2016 21:45:40 +0000 (17:45 -0400)
index.html

index 85d981e828ae1a188721fd0057e73cc2e0c6c696..19d694295be81dad8d59a7ebe3d3ee4c5a37e036 100644 (file)
@@ -8604,7 +8604,7 @@ int main(int argc, char *argv[])
 }
 ```</pre>
 </div>
-<div created="20160816212627236" creator="lh3" modified="20160816214112990" modifier="lh3" tags="[[Library Documentations]]" title="Kexpr: parsing mathematical expressions">
+<div created="20160816212627236" creator="lh3" modified="20160816214517684" modifier="lh3" tags="[[Library Documentations]]" title="Kexpr: parsing mathematical expressions">
 <pre>!!Synopsis
 * Functionality: parse a mathematical expression with the [[Shunting-yard algorithm|https://en.wikipedia.org/wiki/Shunting-yard_algorithm]] and evaluate the final value. The library supports functions and variables.
 * Library source code: [[kexpr.h|https://github.com/attractivechaos/klib/blob/master/kexpr.h]] and [[kexpr.c|https://github.com/attractivechaos/klib/blob/master/kexpr.c]]
@@ -8624,6 +8624,7 @@ int main()
        ke_set_real(ke, &quot;x&quot;, 1.0);               // set the value of a variable
        ke_set_real_func1(ke, &quot;myexp&quot;, exp);     // define a math function
        printf(&quot;%g\n&quot;, ke_eval_real(ke, &amp;err));  // compute the expression
+       ke_destroy(ke);                          // deallocate
        return 0;
 }
 ```