summaryrefslogtreecommitdiffstats
path: root/include/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-06 15:27:19 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-02-18 10:50:43 +0100
commit2ee2f1e41517efa7b5dd604a68ceca9b1377de2c (patch)
tree21d8a1e36e83e83aba5cc549aa1d7a5c2ca06d83 /include/qapi
parent248337e178fbcf1c20132d4f3d1033cb0dde7638 (diff)
downloadhqemu-2ee2f1e41517efa7b5dd604a68ceca9b1377de2c.zip
hqemu-2ee2f1e41517efa7b5dd604a68ceca9b1377de2c.tar.gz
error: New convenience function error_report_err()
I've typed error_report("%s", error_get_pretty(ERR)) too many times already, and I've fixed too many instances of qerror_report_err(ERR) to error_report("%s", error_get_pretty(ERR)) as well. Capture the pattern in a convenience function. Since it's almost invariably followed by error_free(), stuff that into the convenience function as well. The next patch will put it to use. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include/qapi')
-rw-r--r--include/qapi/error.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/qapi/error.h b/include/qapi/error.h
index d712089..f44c451 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -83,6 +83,11 @@ Error *error_copy(const Error *err);
const char *error_get_pretty(Error *err);
/**
+ * Convenience function to error_report() and free an error object.
+ */
+void error_report_err(Error *);
+
+/**
* Propagate an error to an indirect pointer to an error. This function will
* always transfer ownership of the error reference and handles the case where
* dst_err is NULL correctly. Errors after the first are discarded.
OpenPOWER on IntegriCloud