From nobody Mon Feb 9 00:42:33 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1580475754271923.4842593485704; Fri, 31 Jan 2020 05:02:34 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixVvj-0001P1-3L; Fri, 31 Jan 2020 13:01:51 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixVvh-0001On-Qk for xen-devel@lists.xenproject.org; Fri, 31 Jan 2020 13:01:49 +0000 Received: from relay.sw.ru (unknown [185.231.240.75]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d4888744-4429-11ea-8396-bc764e2007e4; Fri, 31 Jan 2020 13:01:44 +0000 (UTC) Received: from vovaso.qa.sw.ru ([10.94.3.0] helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1ixVvH-0000zU-Oq; Fri, 31 Jan 2020 16:01:23 +0300 X-Inumbo-ID: d4888744-4429-11ea-8396-bc764e2007e4 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Date: Fri, 31 Jan 2020 16:01:08 +0300 Message-Id: <20200131130118.1716-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200131130118.1716-1-vsementsov@virtuozzo.com> References: <20200131130118.1716-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v7 01/11] qapi/error: add (Error **errp) cleaning APIs X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Laszlo Ersek , qemu-block@nongnu.org, Paul Durrant , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , armbru@redhat.com, Max Reitz , Greg Kurz , Stefano Stabellini , Gerd Hoffmann , Stefan Hajnoczi , Anthony Perard , xen-devel@lists.xenproject.org, Eric Blake , Michael Roth , Stefan Berger Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add functions to clean Error **errp: call corresponding Error *err cleaning function an set pointer to NULL. New functions: error_free_errp error_report_errp warn_report_errp Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Greg Kurz Reviewed-by: Eric Blake --- CC: Eric Blake CC: Kevin Wolf CC: Max Reitz CC: Greg Kurz CC: Stefano Stabellini CC: Anthony Perard CC: Paul Durrant CC: Stefan Hajnoczi CC: "Philippe Mathieu-Daud=C3=A9" CC: Laszlo Ersek CC: Gerd Hoffmann CC: Stefan Berger CC: Markus Armbruster CC: Michael Roth CC: qemu-block@nongnu.org CC: xen-devel@lists.xenproject.org include/qapi/error.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/qapi/error.h b/include/qapi/error.h index ad5b6e896d..d34987148d 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -309,6 +309,32 @@ void warn_reportf_err(Error *err, const char *fmt, ...) void error_reportf_err(Error *err, const char *fmt, ...) GCC_FMT_ATTR(2, 3); =20 +/* + * Functions to clean Error **errp: call corresponding Error *err cleaning + * function, then set pointer to NULL. + */ +static inline void error_free_errp(Error **errp) +{ + assert(errp && *errp); + error_free(*errp); + *errp =3D NULL; +} + +static inline void error_report_errp(Error **errp) +{ + assert(errp && *errp); + error_report_err(*errp); + *errp =3D NULL; +} + +static inline void warn_report_errp(Error **errp) +{ + assert(errp && *errp); + warn_report_err(*errp); + *errp =3D NULL; +} + + /* * Just like error_setg(), except you get to specify the error class. * Note: use of error classes other than ERROR_CLASS_GENERIC_ERROR is --=20 2.21.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel