diff options
Diffstat (limited to 'libavutil/eval.c')
-rw-r--r-- | libavutil/eval.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libavutil/eval.c b/libavutil/eval.c index faa74a05fd..066bf7bab5 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -472,7 +472,7 @@ int av_expr_parse(AVExpr **expr, const char *s, const char * const *func2_names, double (* const *funcs2)(void *, double, double), int log_offset, void *log_ctx) { - Parser p; + Parser p = { 0 }; AVExpr *e = NULL; char *w = av_malloc(strlen(s) + 1); char *wp = w; @@ -517,7 +517,7 @@ end: double av_expr_eval(AVExpr *e, const double *const_values, void *opaque) { - Parser p; + Parser p = { 0 }; p.const_values = const_values; p.opaque = opaque; @@ -576,6 +576,8 @@ void av_free_expr(AVExpr *e) #ifdef TEST #undef printf +#include <string.h> + static double const_values[] = { M_PI, M_E, @@ -588,7 +590,7 @@ static const char *const_names[] = { 0 }; -int main(void) +int main(int argc, char **argv) { int i; double d; @@ -669,13 +671,16 @@ int main(void) NULL, NULL, NULL, NULL, NULL, 0, NULL); printf("%f == 0.931322575\n", d); - for (i=0; i<1050; i++) { - START_TIMER + if (argc > 1 && !strcmp(argv[1], "-t")) { + for (i = 0; i < 1050; i++) { + START_TIMER; av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL); - STOP_TIMER("av_expr_parse_and_eval") + STOP_TIMER("av_expr_parse_and_eval"); + } } + return 0; } #endif |