From 7b9a3df5d71677c9a03ffea1699c416883c5d176 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 4 Mar 2013 18:34:35 +0100 Subject: [PATCH] lavu/opt-test: do not explicitly set default value in test_ctx Let av_opt_set_defaults() set the value, which is simpler and more idiomatic. --- libavutil/opt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 61c76daa6e..211ca5e317 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1323,7 +1323,7 @@ static const AVOption test_options[]= { {"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100 }, {"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1 }, {"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 10 }, -{"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, {0}, CHAR_MIN, CHAR_MAX }, +{"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, {.str = "default"}, CHAR_MIN, CHAR_MAX }, {"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, 0, "flags" }, {"cool", "set cool flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_COOL}, INT_MIN, INT_MAX, 0, "flags" }, {"lame", "set lame flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_LAME}, INT_MIN, INT_MAX, 0, "flags" }, @@ -1385,7 +1385,6 @@ int main(void) test_ctx.class = &test_class; av_opt_set_defaults(&test_ctx); - test_ctx.string = av_strdup("default"); av_log_set_level(AV_LOG_DEBUG);