[FFmpeg-devel] [PATCH 10/12] Change the order of parameter for ff_parse_expr().
Stefano Sabatini
stefano.sabatini-lala
Mon Apr 12 00:38:06 CEST 2010
Make it list the names before the values, looks less awkward for the
reader.
---
libavcodec/eval.c | 21 +++++++++++----------
libavcodec/eval.h | 7 ++++---
libavcodec/ratecontrol.c | 2 +-
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/libavcodec/eval.c b/libavcodec/eval.c
index 50aff9b..73a5904 100644
--- a/libavcodec/eval.c
+++ b/libavcodec/eval.c
@@ -435,9 +435,10 @@ static int verify_expr(AVExpr *e)
}
}
-int ff_parse_expr(AVExpr **expr, const char *s, const char * const *var_names,
- double (**func1)(void *, double), const char * const *func1_names,
- double (**func2)(void *, double, double), const char * const *func2_names,
+int ff_parse_expr(AVExpr **expr, const char *s,
+ const char * const *var_names,
+ const char * const *func1_names, double (**func1)(void *, double),
+ const char * const *func2_names, double (**func2)(void *, double, double),
void *log_ctx)
{
Parser p;
@@ -487,8 +488,8 @@ int ff_parse_and_eval_expr(double *res, const char *s,
void *opaque, void *log_ctx)
{
AVExpr *e;
+ int ret = ff_parse_expr(&e, s, var_names, func1_names, func1, func2_names, func2, log_ctx);
- int ret = ff_parse_expr(&e, s, var_names, func1, func1_names, func2, func2_names, NULL);
if (ret < 0) {
*res = NAN;
return ret;
@@ -502,18 +503,18 @@ int ff_parse_and_eval_expr(double *res, const char *s,
#undef printf
-static double var_values[]={
- M_PI,
- M_E,
- 0
-};
-
static const char *var_names[]={
"PI",
"E",
0
};
+static double var_values[]={
+ M_PI,
+ M_E,
+ 0
+};
+
int main(void)
{
int i;
diff --git a/libavcodec/eval.h b/libavcodec/eval.h
index f0518f4..dc9b835 100644
--- a/libavcodec/eval.h
+++ b/libavcodec/eval.h
@@ -66,9 +66,10 @@ int ff_parse_and_eval_expr(double *res, const char *s,
* @return 0 in case of success, a negative error corresponding to an
* AVERROR code in case of failure
*/
-int ff_parse_expr(AVExpr **expr, const char *s, const char * const *var_names,
- double (**func1)(void *, double), const char * const *func1_names,
- double (**func2)(void *, double, double), const char * const *func2_names,
+int ff_parse_expr(AVExpr **expr, const char *s,
+ const char * const *var_names,
+ const char * const *func1_names, double (**func1)(void *, double),
+ const char * const *func2_names, double (**func2)(void *, double, double),
void *log_ctx);
/**
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 3040967..8bb5615 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -106,7 +106,7 @@ int ff_rate_control_init(MpegEncContext *s)
};
emms_c();
- ret = ff_parse_expr(&rcc->rc_eq_eval, s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1, func1_names, NULL, NULL, s->avctx);
+ ret = ff_parse_expr(&rcc->rc_eq_eval, s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, s->avctx);
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->avctx->rc_eq);
return ret;
--
1.7.0
More information about the ffmpeg-devel
mailing list