error: Implement the warn and free Error functions
Implement warn_report_err() and warn_reportf_err() functions which are the same as the error_report_err() and error_reportf_err() functions except report a warning instead of an error. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <276ff93eadc0b01b8243cc61ffc331f77922c0d0.1499866456.git.alistair.francis@xilinx.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
c51c4f8807
commit
e43ead1d0b
|
@ -266,11 +266,22 @@ void error_free(Error *err);
|
|||
*/
|
||||
void error_free_or_abort(Error **errp);
|
||||
|
||||
/*
|
||||
* Convenience function to warn_report() and free @err.
|
||||
*/
|
||||
void warn_report_err(Error *err);
|
||||
|
||||
/*
|
||||
* Convenience function to error_report() and free @err.
|
||||
*/
|
||||
void error_report_err(Error *err);
|
||||
|
||||
/*
|
||||
* Convenience function to error_prepend(), warn_report() and free @err.
|
||||
*/
|
||||
void warn_reportf_err(Error *err, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
|
||||
/*
|
||||
* Convenience function to error_prepend(), error_report() and free @err.
|
||||
*/
|
||||
|
|
|
@ -2533,6 +2533,7 @@ sub process {
|
|||
error_setg_file_open|
|
||||
error_set|
|
||||
error_prepend|
|
||||
warn_reportf_err|
|
||||
error_reportf_err|
|
||||
error_vreport|
|
||||
warn_vreport|
|
||||
|
|
20
util/error.c
20
util/error.c
|
@ -232,6 +232,15 @@ void error_report_err(Error *err)
|
|||
error_free(err);
|
||||
}
|
||||
|
||||
void warn_report_err(Error *err)
|
||||
{
|
||||
warn_report("%s", error_get_pretty(err));
|
||||
if (err->hint) {
|
||||
error_printf_unless_qmp("%s", err->hint->str);
|
||||
}
|
||||
error_free(err);
|
||||
}
|
||||
|
||||
void error_reportf_err(Error *err, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -242,6 +251,17 @@ void error_reportf_err(Error *err, const char *fmt, ...)
|
|||
error_report_err(err);
|
||||
}
|
||||
|
||||
|
||||
void warn_reportf_err(Error *err, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
error_vprepend(&err, fmt, ap);
|
||||
va_end(ap);
|
||||
warn_report_err(err);
|
||||
}
|
||||
|
||||
void error_free(Error *err)
|
||||
{
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in New Issue