fftools/opt_common: replace exit_program() with returning error codes

This commit is contained in:
Anton Khirnov 2023-07-14 13:49:49 +02:00
parent a50f90f1c2
commit 4adbe2d219
1 changed files with 5 additions and 3 deletions

View File

@ -1159,7 +1159,9 @@ int init_report(const char *env, FILE **file)
report_file_level = strtol(val, &tail, 10); report_file_level = strtol(val, &tail, 10);
if (*tail) { if (*tail) {
av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n"); av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n");
exit_program(1); av_free(key);
av_free(val);
return AVERROR(EINVAL);
} }
envlevel = 1; envlevel = 1;
} else { } else {
@ -1219,7 +1221,7 @@ int opt_max_alloc(void *optctx, const char *opt, const char *arg)
max = strtol(arg, &tail, 10); max = strtol(arg, &tail, 10);
if (*tail) { if (*tail) {
av_log(NULL, AV_LOG_FATAL, "Invalid max_alloc \"%s\".\n", arg); av_log(NULL, AV_LOG_FATAL, "Invalid max_alloc \"%s\".\n", arg);
exit_program(1); return AVERROR(EINVAL);
} }
av_max_alloc(max); av_max_alloc(max);
return 0; return 0;
@ -1293,7 +1295,7 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
"Possible levels are numbers or:\n", arg); "Possible levels are numbers or:\n", arg);
for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", log_levels[i].name); av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", log_levels[i].name);
exit_program(1); return AVERROR(EINVAL);
} }
end: end: