[FFmpeg-devel] [PATCH] avformat/dvdvideodec: remove `if ((ret = ...) < 0)` pattern

Stefano Sabatini stefasab at gmail.com
Wed Mar 27 14:08:05 EET 2024


On date Wednesday 2024-03-27 12:32:11 +0100, Andreas Rheinhardt wrote:
> Marth64:
> > Recent advice plus my own experience agree that this pattern
> > is error-prone. Instead, set `ret` in its own line and do
> > the error validation after. Also, explicitly return 0 on success
> > in dvdvideo_chapters_setup_preindex()
> > 
> > Signed-off-by: Marth64 <marth64 at proxyid.net>
> > ---
> >  libavformat/dvdvideodec.c | 132 +++++++++++++++++++++++++-------------
> >  1 file changed, 86 insertions(+), 46 deletions(-)
[...] 
> When I argued against the "if ((ret = ...) < 0)" pattern, I meant single
> checks. In chained cases like the above the compactness outweighs the
> potential precedence problem.

Holding the patch for now, so it can be reworked to reduce the scope
of this change.


More information about the ffmpeg-devel mailing list