[FFmpeg-devel] [PATCH 3/3] Make opt_default(), return an error code rather than exit from the program.

Stefano Sabatini stefano.sabatini-lala
Sun Nov 7 16:32:45 CET 2010


On date Sunday 2010-11-07 16:18:10 +0100, Michael Niedermayer encoded:
> On Sun, Nov 07, 2010 at 10:42:12AM +0100, Stefano Sabatini wrote:
> > On date Sunday 2010-11-07 01:04:49 +0100, Michael Niedermayer encoded:
> > > On Sun, Nov 07, 2010 at 12:53:35AM +0100, Stefano Sabatini wrote:
> > > > On date Sunday 2010-11-07 00:38:48 +0100, Michael Niedermayer encoded:
> > > > > On Sat, Nov 06, 2010 at 03:02:57PM +0100, Stefano Sabatini wrote:
> > > > > > This allows the program to nicely handle the error, for example
> > > > > > providing detailed error explanation to the user or cleaning up the
> > > > > > allocated resources of the program.
> > > > > 
> > > > > there is plenty of code that does not check its return value
> > > > > and i dont think adding checks everywhere is a good idea
> > > > 
> > > > In general returning meaningful values *is* a good idea, but I'm
> > > > not going to add them to all the FFmpeg codebase, but *this patch* is
> > > > required by the previous patches in this series, to make ffmpeg prints
> > > > something useful after opt_default() is called, rather than just
> > > > abort.
> > > 
> > > grep for opt_default and you will see there are alot of cases where the
> > > return value is not checked and not exiting anymore will lead to actual
> > > bugs
> > 
> > All but one of those uses are in opt_target() where the value is fixed
> 
> until someone changes it ...
> anyway, i dont strongly care about the return vs exit but i strongly object
> to adding 20 checks in all uses of opt_default()

opt_default_or_die(opt, arg)?
-- 
FFmpeg = Fundamental and Fierce Multimedia Practical Everlasting Goblin



More information about the ffmpeg-devel mailing list