diff mbox series

[FFmpeg-devel,45/47] fftools/ffprobe: inline opt_output_file() into its only caller

Message ID 20230715104611.17902-45-anton@khirnov.net
State Accepted
Commit be49c48282704ada90d2130c8c5193bb97a7cfaa
Headers show
Series [FFmpeg-devel,01/47] fftools/ffmpeg_mux_init: handle pixel format endianness | 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

Anton Khirnov July 15, 2023, 10:46 a.m. UTC
There is no reason to keep them separate.

Also, replace exit_program() with returning an error code.
---
 fftools/ffprobe.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Stefano Sabatini Aug. 2, 2023, 5:28 a.m. UTC | #1
On date Saturday 2023-07-15 12:46:09 +0200, Anton Khirnov wrote:
> There is no reason to keep them separate.
> 
> Also, replace exit_program() with returning an error code.
> ---
>  fftools/ffprobe.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 6180a5c952..e234c92904 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -3795,22 +3795,18 @@ static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
>      return 0;
>  }
>  
> -static void opt_output_file(void *optctx, const char *arg)
> +static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
>  {
>      if (output_filename) {
>          av_log(NULL, AV_LOG_ERROR,
>                  "Argument '%s' provided as output filename, but '%s' was already specified.\n",
>                  arg, output_filename);
> -        exit_program(1);
> +        return AVERROR(EINVAL);
>      }
>      if (!strcmp(arg, "-"))
>          arg = "fd:";
>      output_filename = arg;
> -}
>  
> -static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
> -{
> -    opt_output_file(optctx, arg);
>      return 0;
>  }
>  

LGTM.
diff mbox series

Patch

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 6180a5c952..e234c92904 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3795,22 +3795,18 @@  static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
     return 0;
 }
 
-static void opt_output_file(void *optctx, const char *arg)
+static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
 {
     if (output_filename) {
         av_log(NULL, AV_LOG_ERROR,
                 "Argument '%s' provided as output filename, but '%s' was already specified.\n",
                 arg, output_filename);
-        exit_program(1);
+        return AVERROR(EINVAL);
     }
     if (!strcmp(arg, "-"))
         arg = "fd:";
     output_filename = arg;
-}
 
-static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
-{
-    opt_output_file(optctx, arg);
     return 0;
 }