diff mbox series

[FFmpeg-devel,5/5] fftools/ffmpeg_opt: Reduce scope of variables for deprecated code

Message ID AS8P250MB0744C68F4B79777C5A5D0C508F3CA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 071c625ad71ce328075408d564bbd9d6fbd42c5b
Headers show
Series [FFmpeg-devel,1/5] fftools/ffmpeg_mux_init: Fix leak on error | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt July 22, 2023, 7:11 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffmpeg_opt.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 1860e9d329..dc6044120a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -372,9 +372,6 @@  static int opt_map(void *optctx, const char *opt, const char *arg)
     StreamMap *m = NULL;
     int i, negative = 0, file_idx, disabled = 0;
     int ret;
-#if FFMPEG_OPT_MAP_SYNC
-    char *sync;
-#endif
     char *map, *p;
     char *allow_unused;
 
@@ -387,10 +384,14 @@  static int opt_map(void *optctx, const char *opt, const char *arg)
         return AVERROR(ENOMEM);
 
 #if FFMPEG_OPT_MAP_SYNC
-    /* parse sync stream first, just pick first matching stream */
-    if (sync = strchr(map, ',')) {
-        *sync = 0;
-        av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
+    {
+        /* parse sync stream first, just pick first matching stream */
+        char *sync = strchr(map, ',');
+
+        if (sync) {
+            *sync = 0;
+            av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
+        }
     }
 #endif