[FFmpeg-cvslog] opt-test: Move some variable declarations to avoid block braces

Diego Biurrun git at videolan.org
Mon Apr 18 16:00:54 CEST 2016


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon Mar 21 19:26:29 2016 +0100| [d3044cf37fcd9225788293baa719df68558288be] | committer: Diego Biurrun

opt-test: Move some variable declarations to avoid block braces

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3044cf37fcd9225788293baa719df68558288be
---

 libavutil/opt.c |   71 +++++++++++++++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 36 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index b3435e0..168d3dc 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -801,46 +801,45 @@ static const AVClass test_class = {
 int main(void)
 {
     int i;
+    TestContext test_ctx;
+    const char *options[] = {
+        "",
+        ":",
+        "=",
+        "foo=:",
+        ":=foo",
+        "=foo",
+        "foo=",
+        "foo",
+        "foo=val",
+        "foo==val",
+        "toggle=:",
+        "string=:",
+        "toggle=1 : foo",
+        "toggle=100",
+        "toggle==1",
+        "flags=+mu-lame : num=42: toggle=0",
+        "num=42 : string=blahblah",
+        "rational=0 : rational=1/2 : rational=1/-1",
+        "rational=-1/0",
+    };
+
+    test_ctx.class = &test_class;
 
     printf("\nTesting av_set_options_string()\n");
-    {
-        TestContext test_ctx;
-        const char *options[] = {
-            "",
-            ":",
-            "=",
-            "foo=:",
-            ":=foo",
-            "=foo",
-            "foo=",
-            "foo",
-            "foo=val",
-            "foo==val",
-            "toggle=:",
-            "string=:",
-            "toggle=1 : foo",
-            "toggle=100",
-            "toggle==1",
-            "flags=+mu-lame : num=42: toggle=0",
-            "num=42 : string=blahblah",
-            "rational=0 : rational=1/2 : rational=1/-1",
-            "rational=-1/0",
-        };
-
-        test_ctx.class = &test_class;
-        av_opt_set_defaults(&test_ctx);
-        test_ctx.string = av_strdup("default");
-        if (!test_ctx.string)
-            return AVERROR(ENOMEM);
 
-        av_log_set_level(AV_LOG_DEBUG);
+    av_opt_set_defaults(&test_ctx);
+    test_ctx.string = av_strdup("default");
+    if (!test_ctx.string)
+        return AVERROR(ENOMEM);
+
+    av_log_set_level(AV_LOG_DEBUG);
 
-        for (i=0; i < FF_ARRAY_ELEMS(options); i++) {
-            av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]);
-            if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0)
-                av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
-            printf("\n");
-        }
+    for (i = 0; i < FF_ARRAY_ELEMS(options); i++) {
+        av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]);
+        if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0)
+            av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
+        printf("\n");
     }
 
     return 0;



More information about the ffmpeg-cvslog mailing list