@@ -309,6 +309,29 @@ 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_in)
+{
+ error_free(*errp_in);
+ *errp_in = NULL;
+}
+
+static inline void error_report_errp(Error **errp_in)
+{
+ error_report_err(*errp_in);
+ *errp_in = NULL;
+}
+
+static inline void warn_report_errp(Error **errp_in)
+{
+ warn_report_err(*errp_in);
+ *errp_in = 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
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- include/qapi/error.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)