From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2854443C6C for ; Sat, 27 Aug 2022 14:08:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C8FBB68BA0C; Sat, 27 Aug 2022 17:07:58 +0300 (EEST) Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 22E8E68B9E9 for ; Sat, 27 Aug 2022 17:07:52 +0300 (EEST) Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-11dca1c9c01so5532158fac.2 for ; Sat, 27 Aug 2022 07:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=mW/ENs1PxPhSp8dxH7IrxzgKWClKsGnFdeWqEfNcs9E=; b=hcLegxtundEIC0dpEaDBqcNjWKYmFUrNLQ8gEv9vxcElsufNBb0rkdKylkkOEVT94x AGUC4o/obqsGYO4L4uiOa8g2BiuYXw21v7/l2WThk5KSJpMWi+hagb5cR9pq//kIr02/ VcQOHPtKenpkxHebfBnj6TLu6k1YJ/G3nnmveoFs54EJX0W37ftld9PwiK6j+gvYsyGv Duv8ZL37/frnUCqmGqxO4trDtpwx0kT9nqdF2dRgfwOznZQ+0agckhLyVzL8Qst68z1u yBqKAVlAcWDH6ddHQatNvWCwbObx+/a7g5tECyLQ9tMOj34MNEK24HhLcS3JauWE6pUg diUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=mW/ENs1PxPhSp8dxH7IrxzgKWClKsGnFdeWqEfNcs9E=; b=t/drrUncDdW74HUAfNwxp2LeHe9UOsXIgzuNKJFUHL632Lh5QfYCye68Wno54Eo1U7 sY09Q1gkcUbEEZ4hEoXYd9pmX8/EBOcvHV8N49Y7WuCU8RQNedEk/m0ZQjJNykinlQZK TaalbsyD9aUYRpEBa91vmtH1qM0osugzH5EgWwSXWF7q5WMzyuuNIMZHmMpumTOP+Kct JmMVvrM+OlVLW+liI2dcjnLyWgjftSefxKaer/jt40lpuDdXTc2lPOzGXzxfvMQ4+SGJ gK6M4o7BvkNDDw+NeKXEcNIc2duSzvmInAOI8nLNy5zgTHrpcFfvtDPWVvbqHtVXWIB2 Qbpw== X-Gm-Message-State: ACgBeo34p3ydDmqVJB7CAzwg+qfLOVLWjQ67xIzNtqdXEu9/AhqfPah3 9lhurSxqGnDPszUj3QsDDtnV7qndTtg= X-Google-Smtp-Source: AA6agR5HwI7kVVq5JMuExlO30V1MnoiuFvmSBuM5/9EJje0mTyOzLYhACgEMQigKxBcBTcN9xXM72w== X-Received: by 2002:a05:6870:9a05:b0:e6:589e:1ec5 with SMTP id fo5-20020a0568709a0500b000e6589e1ec5mr4101395oab.203.1661609269301; Sat, 27 Aug 2022 07:07:49 -0700 (PDT) Received: from [192.168.0.13] ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id c38-20020a9d27a9000000b0061c80e20c7dsm2518077otb.81.2022.08.27.07.07.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 27 Aug 2022 07:07:48 -0700 (PDT) Message-ID: Date: Sat, 27 Aug 2022 11:07:48 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 1/3] fftools/cmdutils: Add function to report error before exit X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 8/27/2022 10:55 AM, Andreas Rheinhardt wrote: > This is designed to improve and unify error handling for > allocation failures for the many (often small) allocations that we have > in the fftools. These typically either don't return an error message > or an error message that is not really helpful to the user > and can be replaced by a generic error message without loss of > information. > > Signed-off-by: Andreas Rheinhardt > --- > fftools/cmdutils.c | 6 ++++++ > fftools/cmdutils.h | 11 +++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 18e768b386..b6f5c01ca3 100644 > --- a/fftools/cmdutils.c > +++ b/fftools/cmdutils.c > @@ -90,6 +90,12 @@ void register_exit(void (*cb)(int ret)) > program_exit = cb; > } > > +void report_error_then_exit_program(int ret) Maybe report_and_exit instead. report_error_then_exit_program is IMO too long. > +{ > + av_log(NULL, AV_LOG_FATAL, "%s\n", av_err2str(ret)); > + exit_program(AVUNERROR(ret)); > +} > + > void exit_program(int ret) > { > if (program_exit) > diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h > index d87e162ccd..358f0a0ef9 100644 > --- a/fftools/cmdutils.h > +++ b/fftools/cmdutils.h > @@ -54,6 +54,17 @@ extern int hide_banner; > */ > void register_exit(void (*cb)(int ret)); > > +/** > + * Reports an error corresponding to the provided > + * AVERROR code and calls exit_program() with the > + * corresponding POSIX error code. > + * @note ret must be an AVERROR-value of a POSIX error code > + * (i.e. AVERROR(EFOO) and not AVERROR_FOO). > + * library functions can return both, so call this only > + * with AVERROR(EFOO) of your own. > + */ > +void report_error_then_exit_program(int ret) av_noreturn; > + > /** > * Wraps exit with a program-specific cleanup routine. > */ _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".