Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> ---
CC: Cornelia Huck <coh...@redhat.com> CC: Eric Blake <ebl...@redhat.com> CC: Kevin Wolf <kw...@redhat.com> CC: Max Reitz <mre...@redhat.com> CC: Greg Kurz <gr...@kaod.org> CC: Stefan Hajnoczi <stefa...@redhat.com> CC: Stefano Stabellini <sstabell...@kernel.org> CC: Anthony Perard <anthony.per...@citrix.com> CC: Paul Durrant <p...@xen.org> CC: "Philippe Mathieu-Daudé" <phi...@redhat.com> CC: Laszlo Ersek <ler...@redhat.com> CC: Gerd Hoffmann <kra...@redhat.com> CC: Stefan Berger <stef...@linux.ibm.com> CC: Markus Armbruster <arm...@redhat.com> CC: Michael Roth <mdr...@linux.vnet.ibm.com> CC: qemu-bl...@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..fa8d51fd6d 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); +/* + * Functions to clean Error **errp: call corresponding Error *err cleaning + * function an set pointer to NULL + */ +static inline void error_free_errp(Error **errp) +{ + assert(errp && *errp); + error_free(*errp); + *errp = NULL; +} + +static inline void error_report_errp(Error **errp) +{ + assert(errp && *errp); + error_report_err(*errp); + *errp = NULL; +} + +static inline void warn_report_errp(Error **errp) +{ + assert(errp && *errp); + warn_report_err(*errp); + *errp = 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 -- 2.21.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel