diff mbox series

[FFmpeg-devel,1/8] fftools/ffmpeg: simplify ost_iter()

Message ID 20221114151350.5134-1-anton@khirnov.net
State Accepted
Commit 1b076556c65a6b49ab3ee48eda8061f9f0dc180b
Headers show
Series [FFmpeg-devel,1/8] fftools/ffmpeg: simplify ost_iter() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Nov. 14, 2022, 3:13 p.m. UTC
The inner loop never goes through more than 1 iteration, and so can be
replaced by an if().

Found-by: Andreas Rheinhardt
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Soft Works Nov. 14, 2022, 5:29 p.m. UTC | #1
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Anton Khirnov
> Sent: Monday, November 14, 2022 4:14 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH 1/8] fftools/ffmpeg: simplify
> ost_iter()
> 
> The inner loop never goes through more than 1 iteration, and so can
> be
> replaced by an if().
> 
> Found-by: Andreas Rheinhardt
> ---
>  fftools/ffmpeg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index e6f6773f6a..0fa2fe8c52 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -612,7 +612,7 @@ static OutputStream *ost_iter(OutputStream *prev)
> 
>      for (; of_idx < nb_output_files; of_idx++) {
>          OutputFile *of = output_files[of_idx];
> -        for (; ost_idx < of->nb_streams; ost_idx++)
> +        if (ost_idx < of->nb_streams)
>              return of->streams[ost_idx];
> 
>          ost_idx = 0;
> --
> 2.35.1


I'm objecting the whole patchset.

I think it's not fundamental enough.

softworkz
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index e6f6773f6a..0fa2fe8c52 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -612,7 +612,7 @@  static OutputStream *ost_iter(OutputStream *prev)
 
     for (; of_idx < nb_output_files; of_idx++) {
         OutputFile *of = output_files[of_idx];
-        for (; ost_idx < of->nb_streams; ost_idx++)
+        if (ost_idx < of->nb_streams)
             return of->streams[ost_idx];
 
         ost_idx = 0;